Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mattslay/4ca9e62f69fb0e18006b8e0675e73a09 to your computer and use it in GitHub Desktop.
Save mattslay/4ca9e62f69fb0e18006b8e0675e73a09 to your computer and use it in GitHub Desktop.
PowerShell - Query software installed on list of machines
$machines = 'MSPC5', 'JRPC5', 'CWPC5', 'RPPC5', 'TMPC4', 'MIPC5', 'TWPC5', 'JBPC5', 'DNC2', 'FS6-VM1', '192.168.0.60'
foreach ($machine in $machines)
{
trap{"$machine`: not reachable or not running WsMan"; continue}
if(test-wsman -ComputerName $machine -ea stop){
$result = gcim -Class CIM_Product -Filter 'Name like "%DWG%"' |
select name, version
Write-Host $machine $result.name, $result.version
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment