I have a script that will pull disk size and free space info from remote machines, but I would like it to display the percentage as well. I've tried numerous examples from the internet, but for some reason it's not working with my script. This is what I have (truncated of course):
Powershell
$pc=computername$colItems=get-wmiobject-class"Win32_LogicalDisk"-namespace"root\CIMV2"-computername$pcforeach($objItemin$colItems){write-host"Drive: "$objItem.Namewrite-host"Name: "$objItem.VolumeName$displayGB=[math]::round($objItem.Size/1024/1024/1024,0)write-host"Total disk size: "$displayGB"GB"$displayGB=[math]::round($objItem.FreeSpace/1024/1024/1024,0)write-host"Free disk size: "$displayGB"GB"
The results look like:
------------------------------------------------------------
Drive: C:
Name: System
Total disk size: 120...