This script reports various useful OS and hardware info from a list of remote computers by polling them asynchronously.
It optionally outputs a log and a CSV file of the data.
This is an update of Get-Model primarily just to add the asynchronicity feature. This relies on the new -Parallel parameter of the ForEach-Object cmdlet, which makes this incompatible with PowerShell 5.1, a limitation not present in Get-Model. This new module also gathers quite a bit more information, including network adapter info.
- Powershell 6+
- Download
Get-MachineInfo.psm1to the appropriate subdirectory of your PowerShell modules directory. - Run it using the examples and parameter documentation below.
Get-MachineInfo "espl-114-01"Get-MachineInfo "espl-114-01","espl-114-02","tb-207-01"Get-MachineInfo "espl-114-*"Get-MachineInfo "espl-114-*","tb-207-01","tb-306-*"Get-MachineInfo -OUDN "OU=Instructional,OU=Desktops,OU=Engineering,OU=Urbana,DC=ad,DC=uillinois,DC=edu" -ComputerName "*"$info = Get-MachineInfo "esb-apl-*" -NoConsoleOutput -PassThru
$info | Select Name,{$_.NetAdapters.Mac}Required string array.
The list of computer names and/or computer name query strings to poll.
Use an asterisk (*) as a wildcard.
The parameter name may be omitted if the value is given as the first or only parameter.
Optional string.
The distinguished name of the OU to limit the computername search to.
Optional switch.
If specified, the resulting info is returned in a PowerShell object.
If not specified, nothing is returned to the output stream, except logging (if any).
When specifying -PassThru, capture the info like so: $info = Get-MachineInfo ....
Optional integer.
The maximum number of computers which will be asynchronously polled simultaneously.
Default is 50.
Optional string.
The full path of a text file to log to.
If omitted, no log will be created.
If :TS: is given as part of the string, it will be replaced by a timestamp of when the script was started, with a format specified by -LogFileTimestampFormat.
Specify :ENGRIT: to use a default path (i.e. c:\engrit\logs\<Module-Name>_<timestamp>.log).
Optional string.
The full path of a CSV file to output resulting data to.
If omitted, no CSV will be created.
If :TS: is given as part of the string, it will be replaced by a timestamp of when the script was started, with a format specified by -LogFileTimestampFormat.
Specify :ENGRIT: to use a default path (i.e. c:\engrit\logs\<Module-Name>_<timestamp>.csv).
Optional switch.
If specified, nothing is output to the console.
Has no effect on -PassThru.
Optional switch.
If specified, progress output is not logged to the console.
The resulting table is still output to the console.
Has no effect on -PassThru.
Optional string.
The string used as an indent, when indenting log entries.
Default is four space characters.
Optional string.
The format of the timestamp used in filenames which include :TS:.
Default is yyyy-MM-dd_HH-mm-ss.
Optional string.
The format of the timestamp which prepends each log line.
Default is [HH:mm:ss:ffff]⎵.
Optional integer.
The level of verbosity to include in output logged to the console and logfile.
Specifying 1 outputs some additional logs per machine polled.
Default is 0.
- Machines for which data could not be retrieved will have an
Errorvalue ofTRUEand will have null data otherwise. - Machines for which data was retrieved will have a null
Errorvalue. - By mseng3. See my other projects here: https://github.com/mmseng/code-compendium.