«

»

Jun 25

Check Free Disk of Computers

It may be useful to find free disk space on multiple computers. Here’s a way to do it.

Create a variable and get computers from a text file like
Computer1
Computer2
Computer3

It is nice to get the results presented with GB on the screen and the computer name.
Of course you can send it to a file also if it’s interesting.

######################################################

clear-host

$computers = get-content “c:\temp\computers.txt”

foreach ($computer in $computers)

{

$Freeespace = Get-WMIObject Win32_LogicalDisk -ComputerName $computer | Where-Object {$_.deviceid -eq “C:”} | select-object FreeSpace | ForEach-Object {[math]::truncate($_.freespace / 1GB)}

write-host $computer$Freeespace“GB “

}

################################################

Here is a good article in the subject
https://technet.microsoft.com/en-us/library/ee692684.aspx

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>