MOL: Active Directory - pg 183 (New-WBBackupTarget)

I was working on the Backup and Restore example in Siddaway’s book and I’ve run into a snag in one of the variables I attempt to set.

On my DC, I have successfully mapped a drive (R:) to another backup server but when I attmept to set the variable:

$backupLocation = New-WBBackupTarget -VolumePath R:

I get the following error:

New-WBBackupTarget : The volume R: is not found.

Is this a Drive env issue? Because I can change to the R: drive in a regular cmd prompt (but cannot in a PS ISE console pane).


How did you map the drive ?

I have seen, drive mapped via net use command will not show in PowerShell. Try mapping the drive using New-PSDrive and then execute the cmdlet.

That make sense thanks, so I disconnetced the former mapped R: drive in cmd prompt console, then successfully re-mapped R: using

New-PSDrive -Name R -PSProvider FileSystem -Root \

…was able to switch to it R:

PS R:>

…but still get same error when attmepting to set the variable:

$backupLocation = New-WBBackupTarget -VolumePath R:

New-WBBackupTarget : The volume R: is not found.

I never used this cmdlet, just read the documentation,

Can you try -NetworkPath and -RemovableDrive, since its a mapped drive, I think there will be some gotcha here.

Yes! -NetworkPath was the way to my share.

PS C:\> $backupLocation

Label                  : 
WBDisk                 : 
WBVolume               : 
Path                   : \\\_DCBackups
TargetType             : Network
InheritAcl             : True
PreserveExistingBackup : False
PS C:\> Start-WBBackup -Policy $wbpolicy
Creating a shadow copy of the volumes in the backup...
Creating a shadow copy of the volumes in the backup...
Volume 1 (30%) of 2 volume(s).

It seems the book assumes a local volume. I couldn’t infer this completely despite the ‘ad hoc’ one-off scenario.

Thank you kindly kv

extending to the Scheduled portion of the exercise, yet another unexpected permissions issue, on the remote share

Set-WBSchedule -Policy $wbpolicy -Schedule 08:00,12:00,16:00,20:00
Set-WBPolicy -Policy $wbpolicy

Set-WBPolicy : The credentials entered are either incorrect or do not have write permissions to the remote shared folder. Please specify 
valid credentials.
  1. I didn’t enter any credentials and don’t see a -credential parameter
  2. I am running as a Domain Admin
  3. The Share was defined for Everyone access so not sure why it’s balking at access for the Set-WBSchedule cmdlet though because I’ve successfully run the earlier script to do a one-off backup to the remote share.

Is the account you use to run this cmdlet is part of Backup Operators group ?

It wasn’t but I added my account to that BuiltIn group. Same issue. But what’s strange is:

  1. I'm already a domain admin
  2. The share permission is Everyone > full control
  3. The file permissions are:
    1. System - full control
    2. my account - full control
yet, the error persists:
Set-WBPolicy : The credentials entered are either incorrect or do not have write permissions to the remote shared folder. Please specify 
valid credentials.

Did you use any credentials while maping the drive ? if not, can you try mapping the drive with credentials of the account in Backup ops group ?
Can you print here hwats there n $WBPolicy variable.

$WBPolicy | Format-List *

Right again…

PS C:\> $WBPolicy | Format-List *

Schedule              : {8/31/2018 8:00:00 AM, 8/31/2018 12:00:00 PM, 8/31/2018 2:28:00 PM, 8/31/2018 4:00:00 PM...}
BackupTargets         : {\\\_DCBackups}
VolumesToBackup       : {Local disk (C:)}
FilesSpecsToBackup    : 
FilesSpecsToExclude   : 
ComponentsToBackup    : 
BMR                   : True
SystemState           : True
OverwriteOldFormatVhd : False
VssBackupOptions      : VssCopyBackup

Once I close the powershell session, how would I ensure:

  1. The Mapped drive stays open?
  2. validate the Schedule another time?

Thanks again.

Not sure on Validating the schedule, but you can use -Persist switch of New-PSdrive, I would suggest you to read the documentation of New-PSDrive cmdlet.

Get-Help New-PSDrive -Full

This was helpful!

:+1: That’s why its Get-Help .

I didn’t have to set any additional parameters of the above script as when I checked this morning after the long weekend, my scheduled backup is completing successfully.

The Month of Lunches book doesn’t go into any further detail about how this is occurring and I’m curious, even though I closed my PS Session console last week after setting the Backup Schedule, where and how is this scheduled being stored and retrieved when the console and server have been logged off?

I was able to retrieve my schedule with various Get-WB* commands to verify my work last week:


NextBackupTime : 9/4/2018 12:00:00 PM
NumberOfVersions : 1
LastSuccessfulBackupTime : 9/4/2018 8:00:11 AM
LastSuccessfulBackupTargetPath : \
LastSuccessfulBackupTargetLabel :
LastBackupTime : 9/4/2018 8:00:11 AM
LastBackupTarget : \
DetailedMessage :
LastBackupResultHR : 0
LastBackupResultDetailedHR : 0
CurrentOperationStatus : NoOperationInProgress