Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Trying to get vss status printed for a particular drive.

$
0
0

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
}



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>