We help IT Professionals succeed at work.
Get Started

Using powershell to backup AD

ndalmolin_13 asked
Last Modified: 2012-05-12
Greetings Powershell Gurus –

Here I am again with more Powershell newbie questions.  The task I would like to accomplish today is to use NTBackup to backup Active Directory on my domain controller to a file on my file server.  Here is a brief summary of my environment:
Domain controller:  DC-1 running Windows Server 2003
File server:  FS-1 running Windows Server 2003

Here is what I’m thinking:

 #Map a network drive
(New-Object -ComObject WScript.Network).MapNetworkDrive("B:","\\FS-1\adbackups")

#Format the date as desired
$date = Get-Date -Format M-d-yyyy

#Run NTBackup
ntbackup.exe backup systemstate /j "DC-1 AD Backup $date" /F "B:\adbackups\DC-1 AD Backup $date.bkf"

I have a couple of questions here.
1.   Can someone explain the drive mapping?  I found the example and it worked, but I couldn’t explain what exactly it is doing if someone asked.
2.  Am I going down the right road with this script?

As always, my apologies for such newbie questions and my sincere gratitude for any and all help/explanations provided.

Best regards,
Watch Question
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE