Created
November 12, 2018 22:16
-
-
Save brettmillerb/aadc7c549a73fceb212aa01845c7a230 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-ShadowStorageSpace { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory, | |
Position = 0, | |
ValueFromPipeline=$true, | |
ValueFromPipelineByPropertyName=$true)] | |
[string[]] | |
$ComputerName | |
) | |
process { | |
foreach ($computer in $ComputerName) { | |
$ShadowStorage = Get-CimInstance -ClassName Win32_ShadowStorage -ComputerName $computer | |
foreach ($disk in $ShadowStorage) { | |
$volObj = Get-CimInstance -ClassName win32_volume -ComputerName $computer | ? deviceid -eq $disk.volume.deviceid | |
[pscustomobject]@{ | |
AllocatedSpace = "{0:N2} Gb ({1:N1}%)" -f ($disk.allocatedspace / 1GB), ($disk.UsedSpace / $volObj.Capacity * 100) | |
UsedSpace = "{0:N2} Gb" -f ($disk.usedspace / 1GB) | |
MaxSpace = "{0:N2} Gb" -f ($disk.maxspace / 1GB) | |
DriveLetter = $volObj.Name | |
ComputerName = $disk.pscomputername | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment