Heute brauchte ich eine Liste all unserer PCs mit ihrem verfügbaren/installierten Hauptspeicher. Nichts leichter als das, denkt der PowerShell-Benutzer:
-
# Checks every computer in the given array for its amount of installed RAM
-
# —————————————————————————- #
-
-
$pcs = @("pc1", "pc2");
-
-
foreach ($pc in $pcs)
-
{
-
$pcInfo = gwmi win32_computersystem -computername $pc;
-
if ($pcInfo -ne $null)
-
{
-
write-host ($pc + ": Installed RAM " + [Math]::round($pcInfo.totalphysicalmemory / (1024 * 1024), 0) + " MB") -foregroundcolor "green";
-
}
-
else
-
{
-
write-host ($pc + ": Could not read computer information") -foregroundcolor "magenta";
-
}
-
}
Mit meinen eigenen Funktionen kann ich dann das Array sogar noch automatisch aus dem Active Directory füllen lassen und vor dem Ermitteln der PC-Informationen prüfen, ob der PC online ist.



