Cannot workaround to use Powershell to recover from a windows server backup to a remote shared path when it is exposed via a different network path.

arnav juneja 0 Reputation points
2023-07-12T20:48:57.9633333+00:00

I am using windows server 16. I have a backup of the system state that was taken on remote share path //IP/pathA using the wbadmin tool.
Now I am trying to restore using this backup. The backup is being exposed using a different remote share path //IP/pathB. Now the issue is that we have do the following steps to initiate the recovery using Powershell

$target=New-WBBackupTarget -NetworkPath "\\IP\pathB" -Credential $Cred
$backups=Get-WBBackupSet -BackupTarget $target
$backup=$backups[0]

Now when I print this $backup object, the BackupTarget field is still the original path the backup was taken to.

$backup.BackupTarget : \\IP\pathA

If I initiate the recovery using the command Start-WBSystemStateRecovery -BackupSet $backup -Async it fails with "The remote shared folder does not exist" error.
How can I workaround and perform the recovery using Powershell when the backup is exposed from a different remote path than it was taken on.

Please note that I want to perform the recovery specifically from Powershell. I am able to perform it via the GUI.

Windows Server 2016
Windows Server 2016
A Microsoft server operating system that supports enterprise-level management updated to data storage.
2,423 questions
Windows Server Backup
Windows Server Backup
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Backup: A duplicate copy of a program, a disk, or data, made either for archiving purposes or for safeguarding valuable files from loss should the active copy be damaged or destroyed.
463 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,443 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 32,741 Reputation points Microsoft Vendor
    2023-09-08T08:11:33.7666667+00:00

    Hi,

    You can modify the BackupTarget property of $backup to \\IP\pathB like below.

    $mPath = $backup.BackupTarget.GetType().GetField('mPath','static,nonpublic,instance')
    $mPath.setvalue($backup.BackupTarget,'\\IP\pathB')
    $mAccessPath = $backup.BackupTarget.GetType().GetField('mAccessPath','static,nonpublic,instance')
    $mAccessPath.setvalue($backup.BackupTarget,'\\IP\pathB')
    

    Best Regards,

    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.