$arrComputers = get-Content -path "c:\servers.txt"
foreach ($strComputer in $arrComputers)
{
$collItems = Get-WmiObject -class "Win32_OperatingSystem" -namespace "root\CIMV2" -computername $strComputer
foreach ($objItem in $collItems)
{
"Computer Name: ;" + $strComputer
"Operating System: ;" + $objItem.Caption
"Servicepack: ;" + $objItem.ServicePackMajorVersion
" "
}
$collSNMP = Get-WmiObject -class "Win32_service" -namespace "root\CIMV2" -computername $strComputer | Where-Object {$_.Name -eq "SNMP"}
foreach ($objItem in $collSNMP)
{
"SNMP: ;" + $objItem.Name
" "
}
$collProcArch = Get-WmiObject -class "Win32_processor" -namespace "root\CIMV2" -computername $strComputer | Select-Object Caption
foreach ($objItem in $collProcArch)
{
"Architecture: ;" + $objItem.Caption
}
" "
"--------------------------------------------------------------"
}
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
From novice to tech pro — start learning today.
HTH
Chris
Open in new window