Scripts/Storage/VolumeShadowCopy.ps1
try { function GetDriveLetter { Param([string]$VolumeID) ($Win32_Volume | Where-Object {$_.deviceid -eq $VolumeID }).driveletter } if ($Win32_ShadowCopy) { $Win32_ShadowCopy | foreach { $Psobject=New-Object -TypeName psobject $InstallDate=$_.ConvertToDateTime($_.InstallDate) $Psobject | Add-Member -MemberType NoteProperty -Name InstallDate -Value $InstallDate $DrLetter=GetDriveLetter -VolumeID $_.volumename $Psobject| Add-Member -MemberType NoteProperty -Name Drive -Value $DrLetter $Psobject| Add-Member -MemberType NoteProperty -Name ID -Value $_.ID $Psobject } } else { $Psobject=New-Object -TypeName psobject $Psobject | Add-Member -MemberType NoteProperty -Name InstallDate -Value $null $Psobject| Add-Member -MemberType NoteProperty -Name Drive -Value $null $Psobject| Add-Member -MemberType NoteProperty -Name ID -Value $null $Psobject } } catch { Write-Error $_ } |