$computers= Get-Content -Path C:\servers.txt
$info=@()
foreach($computer in $computers){
$colItems = get-wmiobject -class "Win32_ComputerSystem" -namespace "root\CIMV2" -computername $computer
foreach ($objItem in $colItems){
$displayGB = [math]::round($objItem.TotalPhysicalMemory/1024/1024/1024, 0)
$res = "" | select Computer,Memory
$res.computer = $computer
$res.Memory = $displayGB
$info +=$res
}
}
$info | Export-Csv c:\12.csv -NoTypeInformation
No comments:
Post a Comment