Saturday, March 15, 2014

Sorry for the sloppy  script window here, still trying to figure out how to get it to show all neat and tidy on Blogger.

This Function I have found supper useful since at work to save drive letters many of our servers use mount points but we still haven't found a friendly way to check on the capacity and storage usage of them. This in combination of some other functions have become a staple of mine when checking system health and planning for additional storage needs.
 
 
 
  1. Function get-mountpoints {  
  2. Param(  
  3.     [Parameter(Mandatory=$True,Position=1)]  
  4.     [Array]$PC  
  5. )  
  6.     $volumes=@()  
  7.     $TotalGB = @{Name="Capacity(GB)";expression={[math]::round(($_.Capacity/ 1073741824),2)}}  
  8.     $FreeGB = @{Name="FreeSpace(GB)";expression={[math]::round(($_.FreeSpace / 1073741824),2)}}  
  9.     $FreePerc = @{Name="Free(%)";expression={[math]::round(((($_.FreeSpace / 1073741824)/($_.Capacity / 1073741824)) * 100),0)}}  
  10.     $volumes = Get-WmiObject -computer $PC win32_volume | Where-object {$_.name -notlike '\\?\*'}  
  11.     $volumes | Select SystemName, Label, Name, $TotalGB$FreeGB$FreePerc | Sort-Object name | Write-Output  
  12. }  

No comments:

Post a Comment