![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Free Disk Space I haven't used Powershell before and I am new to scripting. I need to run a scrip to report available free disk space on 20 plus Servers. Is this possible with Powershell and how hard is it to create? Thank you in advance |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Free Disk Space It's easy enough... :-) Essentially, you're going to use WMI to get the disk space. You have more options for dealing with the list of servers. Let's say you've got a file called servers.txt which has a server name per line... foreach ($server in (get-content servers.txt)) { $server get-wmiobject win32_LogicalDisk -computername $server -filter "DriveType=3" | format-table DeviceID,Freespace -autosize } This picks each server name out of the file and uses it in a script block which: Displays the server name Gets the local logical hard drives (drivetype 3) using WMI and pipes it to Format-table to output the freespace If you want to test it out without hitting your servers, or don't have a file, you can stick an array of computer names in the foreach like: foreach ($server in "localhost",".") The freespace is in bytes, so you probably want to format the output a bit better with something like this: format-table DeviceID,@{Label="Gb Free(Approx.)";Expression={[int] ($_.Freespace/1GB)}} -autosize} I wrote a blog post a while ago which checks disk space for all the machines in an OU, which you may wish to check out at http://jonoble.spaces.live.com/blog/...94A5!545.entry |
My System Specs![]() |
| | #3 (permalink) |
| | RE: Free Disk Space Pat, I have created a script that you will like that will gather what you want and more. If you are interested shoot me an email and I will give it to you and explain it. I would post it here but it will look very ugly. jsampson@xxxxxx "Pat" wrote: Quote: > I haven't used Powershell before and I am new to scripting. > > I need to run a scrip to report available free disk space on 20 plus Servers. > Is this possible with Powershell and how hard is it to create? > > > > Thank you in advance |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| No free disk space error even though there is enough disk space on Windows Vista x64 | Vista installation & setup | |||
| Query disk free space.... | PowerShell | |||
| Misreported Used/Free Disk Space | Vista General | |||
| Out of disk space error at installations, though 100 Gb free space | Vista General | |||
| disk free space anomaly | Vista performance & maintenance | |||