I now use a format specifier to change the way the numbers display. Unfortunately, the output is still a bit difficult to read due to the great amount of precision following the decimal. PS C:\> gwmi win32_volume -Filter ‘drivetype = 3’ | select driveletter, label, } I add it to a custom object, and I create a custom label. To do this, I divide by the GB admin constant. First, it requires converting the free space from bytes to gigabytes. To fix the output requires a couple of things. However, a drive type of 3 is a fixed local disk, and it is the information you want to receive. A generic query to Win32_Volume returns the CD-ROM drive, mapped network drives, and other things you may not be interested in receiving. Unfortunately, this property displays in bytes, which means that the numbers are rather large and difficult to comprehend. The WMI class Win32_Volume (in the operating system since Windows Server 2003) contains a property named freespace. You should read yesterday’s blog, Use PowerShell to Create an HTML Uptime Report, prior to reading today’s. Note This is the second blog in a series that discusses creating an HTML report that contains server status information. What I will do is add free disk space to the report-that should work for you. But hey, it is cooler than it has been in a week, so we will accept any temperature relief offered.ĭV, because it is a nice cool day down here, I am going to cheat a bit and use the report and the same basic script I wrote yesterday. It is because the skies are cloudy and it is threatening thunder storms. Today it is cool down here in Charlotte, North Carolina in the southern portion of the United States. Microsoft Scripting Guy, Ed Wilson, is here. Can you help me out? I have seen some scripts on the Script Repository, but nothing that creates a very nice report. I need something that will produce a daily report letting me know the amount of free disk space on each of the drives. What we do have is a CIO who has no clues about how computers work, and who goes herbitile when any server is down for even five seconds, not to mention when a server is down for a couple of days and we have to order a new drive and restore things from tape to rebuild the system drive. We are a small shop, and we do not have a network monitoring program such as System Center. Part of the problem is that they were built several years ago, and with all of the patches, service packs, software installed and uninstalled, registry bloat, and whatever else, we are constantly running out of disk space. Hey, Scripting Guy! I know it may be hard to believe in today’s era of multiterabyte disks on laptops, but our servers are constantly running out of disk space. Summary: Microsoft Scripting Guy, Ed Wilson, shows how to use Windows PowerShell to create a report that displays free disk space on servers.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |