3

I have a powershell script running wbadmin with source C: to a target iSCSI volume which is specified by its volume ID (\?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}). The backup itself runs perfectly fine, I just wanted to add an offsite-backup functionality to the script. Sadly, robocopy cannot use the Volume ID as source for the copy job and will reject it as unknown parameter.

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

The output of "mountvol" looks very promising, but if there is a powershell integrated feature, I would preferably use it.

I already tried Get-PSDrive and Get-Volume, there seems to be no way of getting them to output the VolumeID.

HannesS
  • 173
  • 6

1 Answers1

8

maybe this should help:

gwmi Win32_Volume |
    ? { $_.deviceID -eq '\?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\'} 
          | select -expand name
CB.
  • 58,865
  • 9
  • 159
  • 159
  • I upvote only because I assume it's going to work. Haven't actually tested it but I'm pretty sure I've had to do something like this in the past. – SomeShinyObject May 13 '15 at 11:55
  • Works perfectly, thank you. Didn't think of accessing WMI directly. I would upvote it too, but i still need some rep :( – HannesS May 13 '15 at 12:08
  • @HannesS Glad to help! No prob for the upvote I'm here just for fun ;) – CB. May 13 '15 at 12:09