2 April 2020:
Microsoft is "retiring" the Technet Gallery effective June 2020 - see https://docs.microsoft.com/en-us/teamblog/technet-gallery-retirement
To continue to provide updates to this script, its functionality has been ported out to the Get-PCInfo function of the AZSBTools PowerShell module at the PowerShell Gallery https://www.powershellgallery.com/packages/AZSBTools
To use this new enhanced function:
Install-Module -Name AZSBTools
To see built in help:
help Get-PCInfo -Show
Synopsis Function to ping and report on given one or more Windows computers. Description Function to ping and report on given one or more Windows computers. If the computer has more than one network interface, this function will report all IP and MAC addresses Parameters -ComputerName <String[]> One or more computer names to be reported on. This defaults to the current computer. Required? false Position? 1 Default value $env:COMPUTERNAME Accept pipeline input? true (ByValue, ByPropertyName) Accept wildcard characters? false -Cred <PSCredential> PS Credential object that can be obtained from Get-Credential or Get-SBCredential Required? false Position? 2 Default value Accept pipeline input? false Accept wildcard characters? false -Silent <SwitchParameter> Required? false Position? named Default value False Accept pipeline input? false Accept wildcard characters? false Syntax Get-PCInfo [[-ComputerName] <String[]>] [[-Cred] <PSCredential>] [-Silent ] [<CommonParameters>] Outputs The function returns a PS object that has the following properties/example: ComputerName : WIN10G2-Sam1 Status : Online IPAddress : 192.168.214.118 MACAddress : 00:xx:xx:xx:xx:xx DateBuilt : 9/6/2019 10:38:13 AM OSVersion : 10.0.18363 OSCaption : Microsoft Windows 10 Enterprise OSArchitecture : 64-bit Model : Virtual Machine Manufacturer : Microsoft Corporation VM : True LastBootTime : 3/26/2020 9:38:45 PM Notes Function by Sam Boutros 31 October 2014 v0.1 4 January 2017 v0.2 17 March 2017 v0.3 - chnaged the logic to output 1 record per computer even when it has several NICs 2 April 2020 v0.4 - Added Silent switch to speed up processing of large number of computers Switched to using Get-SBWMI instead of Get-WMIObject Added Cred Parameter to be able to query computers outside the domain Examples -------------------------- EXAMPLE 1 -------------------------- PS C:\>Get-PCInfo This returns the current PC information -------------------------- EXAMPLE 2 -------------------------- PS C:\>$PCInfo = Get-PCInfo -ComputerName @('PC1','PC2','PC3') This checks the listed computers and saves the collected information in $PCInfo variable -------------------------- EXAMPLE 3 -------------------------- PS C:\>(Import-Csv .\ComputerList1.csv).ComputerName | Get-PCInfo | Export-Csv .\ComputerReport.csv -NoType This example will read a list of computer names from the CSV file provided which has a 'ComputerName' column, gather each computer information and save it to the provided CSV output file. -------------------------- EXAMPLE 4 -------------------------- PS C:\>Get-PCInfo -ComputerName Server111 -Cred (Get-SBCredential 'domain\user') This example will report on information of the provided computer using the provided credentials
Synopsis Function to ping and report on given one or more Windows computers. Description Function to ping and report on given one or more Windows computers. If the computer has more than one network interface, this function will report all IP and MAC addresses Parameters -ComputerName <String[]> One or more computer names to be reported on. This defaults to the current computer. Required? false Position? 1 Default value $env:COMPUTERNAME Accept pipeline input? true (ByValue, ByPropertyName) Accept wildcard characters? false -Cred <PSCredential> PS Credential object that can be obtained from Get-Credential or Get-SBCredential Required? false Position? 2 Default value Accept pipeline input? false Accept wildcard characters? false -Silent <SwitchParameter> Required? false Position? named Default value False Accept pipeline input? false Accept wildcard characters? false Syntax Get-PCInfo [[-ComputerName] <String[]>] [[-Cred] <PSCredential>] [-Silent ] [<CommonParameters>] Outputs The function returns a PS object that has the following properties/example: ComputerName : WIN10G2-Sam1 Status : Online IPAddress : 192.168.214.118 MACAddress : 00:xx:xx:xx:xx:xx DateBuilt : 9/6/2019 10:38:13 AM OSVersion : 10.0.18363 OSCaption : Microsoft Windows 10 Enterprise OSArchitecture : 64-bit Model : Virtual Machine Manufacturer : Microsoft Corporation VM : True LastBootTime : 3/26/2020 9:38:45 PM Notes Function by Sam Boutros 31 October 2014 v0.1 4 January 2017 v0.2 17 March 2017 v0.3 - chnaged the logic to output 1 record per computer even when it has several NICs 2 April 2020 v0.4 - Added Silent switch to speed up processing of large number of computers Switched to using Get-SBWMI instead of Get-WMIObject Added Cred Parameter to be able to query computers outside the domain Examples -------------------------- EXAMPLE 1 -------------------------- PS C:\>Get-PCInfo This returns the current PC information -------------------------- EXAMPLE 2 -------------------------- PS C:\>$PCInfo = Get-PCInfo -ComputerName @('PC1','PC2','PC3') This checks the listed computers and saves the collected information in $PCInfo variable -------------------------- EXAMPLE 3 -------------------------- PS C:\>(Import-Csv .\ComputerList1.csv).ComputerName | Get-PCInfo | Export-Csv .\ComputerReport.csv -NoType This example will read a list of computer names from the CSV file provided which has a 'ComputerName' column, gather each computer information and save it to the provided CSV output file. -------------------------- EXAMPLE 4 -------------------------- PS C:\>Get-PCInfo -ComputerName Server111 -Cred (Get-SBCredential 'domain\user') This example will report on information of the provided computer using the provided credentials
17 March 2017 - version 3
4 January 2017 - version 2
For details on updates in v2 see https://superwidgets.wordpress.com/2017/01/04/powershell-script-to-report-on-computer-inventory/
Script to ping and report on computers.Data reported: ComputerName, IPAddress, MACAddress, DateBuilt, OSVersion, Model, and LastBootTimeRequires list of computers in text fileSam Boutros - 10/31/2014 - v1.0
James Medway posted:
This script does just that. Here's a snippet:
<# Script to ping and report on computers. Data reported: ComputerName, IPAddress, MACAddress, DateBuilt, OSVersion, Model, and LastBootTime Requires list of computers in text file Sam Boutros - 10/31/2014 - v1.0 #> $ComputerList = ".\computerlist.txt" $CSVFile = ".\Ping-Report-$(Get-Date -format yyyyMMdd_hhmmsstt).csv" $LogFile = ".\Ping-Report-$(Get-Date -format yyyyMMdd_hhmmsstt).txt" # End Data Entry
<# Script to ping and report on computers. Data reported: ComputerName, IPAddress, MACAddress, DateBuilt, OSVersion, Model, and LastBootTime Requires list of computers in text file Sam Boutros - 10/31/2014 - v1.0 #> $ComputerList = ".\computerlist.txt" $CSVFile = ".\Ping-Report-$(Get-Date -format yyyyMMdd_hhmmsstt).csv" $LogFile = ".\Ping-Report-$(Get-Date -format yyyyMMdd_hhmmsstt).txt" # End Data Entry
It displays results on the screen as shown above, in Gridview:
and exports it to CSV file: