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

Help converting WBAdmin command into powershell

$
0
0

I am having a bit of trouble converting Windows Server Backup commands on a 2012 R2 server into powershell.

The first command is to restore the catalog from a portable drive.  The batch file version is:
wbadmin restore catalog -backupTarget:\\?\Volume{58895c2e-a4f6-4143-8be0-83c85hhhhhh}\ -machine:MyHost -quiet

My attempt to convert this to powershell is:
$Bt="\\?\Volume{58895c2e-a4f6-4143-8be0-83c85hhhhhh}\"
Restore-WBCatalog -BackupTarget $Bt -Force

But this fails with "Cannot bind parameter 'BackupTarget'"

We then have the line:
$version=@(Get-WBBackupSet)[-1].VersionId

Which retrieves the versionId of the most recent backup ok.

The last line we need to convert to powershell is:
wbadmin start recovery -version:$version -itemtype:File -items:k:\Data1.vhdx -backupTarget:\\?\Volume{58895c2e-a4f6-4143-8be0-83c85hhhhhh}\ -machine:MyHost -recoveryTarget:k:\ -overwrite:Overwrite -quiet

Thanks,



Viewing all articles
Browse latest Browse all 15028

Trending Articles



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