Script to create Active Directory Snapshots (better than NTDSUTIL)

This script permits to create Active Directory Snapshots more efficiently than NTDSUTIL especially if you have more than one disk volume on your Domain Controller.For your information, if you have more than one volume, NTDSUTIL is creating a snapshot of all volumes...

 
 
 
 
 
4.5 Star
(2)
1,567 times
Add to favorites
Active Directory
9/7/2014
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Set snapshots location
    1 Posts | Last post August 29, 2016
    • Where I can set path for snapshots? I need to save snapshot on backup share.
  • Better WMI filter
    2 Posts | Last post September 12, 2014
    • It is also best practice to filter with WMI instead of using Where-Object. The trick here is that you need to escape the \ characters. here's an example:
      
      $id = "\\?\Volume{f6333ff6-56d4-11e3-824f-806e6f6e6963}\" 
      $escaped = $id.Replace("\","\\") 
      get-wmiobject -class win32_shadowcopy -filter "Volumename = '$escaped'"   
    • Thanks for the info Jeffery.
      
      
  • Suggestions
    1 Posts | Last post September 12, 2014
    • Use a Here string instead of trying to concatenate
      
      $Content = @"
      set context persistent
      begin backup
      writer verify {b2014c9e-8711-4c5c-a5a9-3cf384484757}
      set metadata $($env:TEMP)\shadowscript.cab
      add volume $($NTDSFileLetter) alias SNAPAD
      create
      end backup
      "@
          $Content | out-file $DShadowFile -encoding ascii -Force 
      
      At least the first line of the Here string must be left justified.  Also use Join-Path instead of concatenating.
      
      $DShadowFile = Join-path -path $env:TEMP -childpath "\shadowscript.dsh" 
  • Thanks
    1 Posts | Last post September 07, 2014