Powershell Script to Compare VolumeID with DriveLetter

I have a powershell script running wbadmin with source C: on the iSCSI target volume that is indicated by its volume id (\? \ Volume {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}). The backup itself works fine, I just wanted to add the functionality of backing up to an external server in the script. Unfortunately robocopy cannot use the volume ID as the source for the copy job and will reject it as an unknown parameter.

Is there a convenient way to get the actual drive letter from the volume ID so that I can replace it before calling robocopy?

The "mountvol" output looks very promising, but if there is a built-in powershell function I would prefer to use it.

I've already tried Get-PSDrive and Get-Volume, there seems to be no way to get them to output VolumeID.

+3


source to share


1 answer


maybe this should help:



gwmi Win32_Volume |
    ? { $_.deviceID -eq '\?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\'} 
          | select -expand name

      

+7


source







All Articles