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

Welcome Forums General PowerShell Q&A MOL: Active Directory - pg 183 (New-WBBackupTarget)

This topic contains 13 replies, has 3 voices, and was last updated by

 
Participant
3 months, 1 week ago.

  • Author
    Posts
  • #110572

    Participant
    Points: 71
    Rank: Member

    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).

    thanks

  • #110573

    Participant
    Points: 878
    Helping Hand
    Rank: Major Contributor

    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.

  • #110575

    Participant
    Points: 71
    Rank: Member

    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 \\10.131.64.14\_DCBackups

    ...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.
  • #110576

    Participant
    Points: 878
    Helping Hand
    Rank: Major Contributor

    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.

  • #110579

    Participant
    Points: 71
    Rank: Member

    Yes! -NetworkPath was the way to my share.

    PS C:\> $backupLocation
    
    
    Label                  : 
    WBDisk                 : 
    WBVolume               : 
    Path                   : \\10.131.64.14\_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

    • #110590

      Participant
      Points: 71
      Rank: Member

      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.

  • #110606

    Participant
    Points: 878
    Helping Hand
    Rank: Major Contributor

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

    • #110699

      Participant
      Points: 71
      Rank: Member

      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.
  • #110702

    Participant
    Points: 878
    Helping Hand
    Rank: Major Contributor

    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 *
  • #110717

    Participant
    Points: 71
    Rank: Member

    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         : {\\10.131.64.14\_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.

  • #110728

    Participant
    Points: 878
    Helping Hand
    Rank: Major Contributor

    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
  • #110800

    Participant
    Points: 1
    Rank: Member

    This was helpful!

    • #110804

      Participant
      Points: 878
      Helping Hand
      Rank: Major Contributor

      👍 That's why its Get-Help .

  • #110888

    Participant
    Points: 71
    Rank: Member

    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:

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

The topic ‘MOL: Active Directory - pg 183 (New-WBBackupTarget)’ is closed to new replies.