In my servers I have set Shadow copying for H: drive to have a shadow copy in I: drive.
I am trying to get the status but the select statement tends to give an empty string if i try to select the pattern(H:) with the braces.
My code:
$VSSdata = vssadmin list shadowstorage
if(Select-String -inputObject $VSSdata -Pattern "No items found")
{
Write-Host "VSS Not Configured"
}
elseif((Select-String -inputObject $VSSdata -Pattern "For volume: (H:)") -and (Select-String -inputObject $VSSdata -Pattern "Shadow Copy Storage volume: (I:)") -and (Select-String -inputObject $VSSdata -Pattern "Maximum Shadow Copy Storage space: UNBOUNDED"))
{
Write-Host "VSS Configured properly For H Drive to I Drive"
}
else
{
Write-Host "VSS Configured different than usual : Configured as follows -> `n`n"$VSSdata
}