Hello, I am getting an access denied error. I am able to ping the Computer's IP address. What sort of permissions are needed to run this script. I am running the script with a csv file with the computerNames.
Include and change the Code for: Add-Type -AssemblyName PresentationFramework $msgBoxInput = [System.Windows .MessageBox]::S how('Testar conexão e exportar relatório?','Re port Ping', 'YesNo') switch ($msgBoxInput) { 'Yes' { $CSVFile = ".\Ping-Report. csv" $ComputerList = ".\computerlist .txt" $PCData = foreach ($PC in ((Get-Content -Path $ComputerList)) ) { _______________ _______________ _______________ _______________ _______________ _______________ Include this code at end of code: $PCData | Sort ComputerName | FT -AutoSize $PCData | Sort ComputerName | Out-GridView $PCData | Sort ComputerName | Export-Csv -Path $CSVFile -Delimiter ';' -NoTypeInformat ion select ComputerName, Status, OSVersion, OSCaption, OSArchitecture, IPAddress, MacAddress, VM, Model, Manufacturer, DateBuilt, LastBootTime $csv = "C:\Temp\Ping-R eport.csv" #Local do Arquivo de Origem $xlsx = "C:\Temp\Ping-R eport.xlsx" #Local do arquivo de Destino $delimiter = ";" # Especifica o delimitador ";" para que o arquivo XSLS separe os campos # Cria uma nova planilha em branco no excel $excel = New-Object -ComObject excel.applicati on $workbook = $excel.Workbook s.Add(1) $worksheet = $workbook.works heets.Item(1) # Cria uma consulta na tabela com formatação de Tipos $TxtConnector = ("TEXT;" + $csv) $Connector = $worksheet.Quer yTables.add($Tx tConnector,$wor ksheet.Range("A 1")) $query = $worksheet.Quer yTables.item($C onnector.name) $query.TextFile OtherDelimiter = $delimiter $query.TextFile ParseType = 1 $query.TextFile ColumnDataTypes = ,1 * $worksheet.Cell s.Columns.Count $query.AdjustCo lumnWidth = 1 # Executa e deletas as consultas $query.Refresh( ) $query.Delete() # Salva e fecha a planilha em Excel $Workbook.SaveA s($xlsx,51) $excel.Quit() [System.Windows .MessageBox]::S how('Executado !! - Relátorio gerado na pasta do aplicativo','Re port Ping') } 'No' { Get-Event | Remove-Event } }
Hi Sam, I'm new to Powershell. This script fits the bill for something I'm trying to accomplish, but I don't understand how to get the syntax to pull from a list to get the output you have structured. How do I get this script to pull read from a list of server names? Thanks, Shawn
how i can configure mail function for to get the reports to windows live mail or outlook mail?
Two things... 1) How do you add more workstations for the script to ping? 2) Where is the result report saved in? Thanks in advance
First line of the script is #Requires -Version 2. Just wondering what that means.
Ooohhh, requires POWERSHELL version 2, right? Not version 2 of your script. DUH
So disregard the last comment I ended up getting the script to work I just had to invoke a command to run the script (which I missed the info). So I ran: Import-Csv .\Computerlist.csv | % { .\Ping-Report-v 3.ps1 $_.ComputerName } | select ComputerName, Status, OSCaption, MACAddress, IPAddress, LastBootTime | Export-Csv C:\_localdata\r eport1.csv -NoType My question now, is in the script itself, how can I get it to read the IP status i.e. Request Timed Out, Bad Hostname etc. As it stands and the way it was written only produces an IP address when pingable which is great and what I like, but if it is not pingable I need to have the report read if it was 'Request Timed Out' or 'Bad Hostname'. As it stands it says "No response to ping" or "Access Denied". I found information on the script I want to use but don't know where in this script I can add or what to modify: $ping = ping $Server -n 1 | Where-Object {$_ -match "Reply" -or $_ -match "Request timed out" -or $_ -match "Destination host unreachable"} (http://www.pow ershellbros.com /powershell-fun ction-to-check- failed-ping-sta tus-request-tim ed-out/)
I am unable to get this script to work for multiple computers, or to get it to export the info to a log file. When I ran the script it simply provided the date for the computer that I was on. I am hoping someone could help with the exact data I should input and where exactly to put it I a very big newbie to power shell, and scripts.
i get following error Send-MailMessage : The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM At line:41 char:1 + Send-MailMessag e @messageParamet ers –BodyAsHtml + ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~ + CategoryInfo : InvalidOperatio n: (System.Net.Mai l.SmtpClient:Sm tpClient) [Send-MailMessa ge], SmtpException + FullyQualifiedE rrorId : SmtpException,M icrosoft.PowerS hell.Commands.S endMailMessage