In my last post, I provided a small batch file to support scheduled IFM dumps of an AD LDS instance. Afterwards, I realised that batch files are sooo last century and decided to have a crack at the Powershell version. I’m no Bwandon, but the script below seems to do the trick.
#
# Name: Create_IFM_Dump.ps1
# Author: Tony Murray
# Version: 1.0
# Date: 20/04/2009
# Comment: PowerShell script to create AD LDS IFM
# backup. To be run nightly as a scheduled task.
#
########################################################## Declare variables$IFMDir = “c:\backup\adlds\Instance1”
$IFMName = “adamntds.dit”
$cmd = $env:SystemRoot + “\system32\dsdbutil.exe”
$flags = “`”ac i Instance1`” ifm `”create full c:\backup\adlds\Instance1`” q q”
$date = get-Date -f “yyyymmdd”
$backupfile = $date + “_adamntds.bak”$DumpIFM = “{0} {1}” -f $cmd,$Flags# Main
# Create the folder if it doesn’t exist if(test-path -path $IFMDir)
{write-host “The folder” $IFMDir “already exists”}
else
{New-Item $IFMDir -type directory}# Clear the IFM folder (Dsdbutil needs folder to be empty before writing to it) Remove-Item $IFMDir\*# Run Dsdbutil.exe to create the IFM dump file Invoke-expression $DumpIFM# Rename the dump file to give the backup a unique name
rename-item $IFMDir”\”$IFMName -newname $backupfile
# End Main
Tony
Pingback: EnterpriseAdmins.org » Blog Archive » Directory partition has not been backed up [DC=virtualcenter,DC=vmware,DC=int]
I have given the user account access to the local “Backup Operators” but script will not run as a scheduled task.
If I run it manually logged in with said user account the dsdbutil backs up the adamntds.dit file within seconds.
Any suggestions?
can u send me the batch file to schdule the adlds instance backup plz..its urgent…plz send it to shovincyriac@gmail.com
Hi Shovin
The link is at the top of the page:
http://www.open-a-socket.com/index.php/2009/04/09/schedule-backups-of-your-ad-lds-instance-using-dsdbutil/
Tony
This was really helpful and I appreciate you sharing it. It saved me a lot of time. One small error I noticed, which is not a huge deal, is that the references to months in the date should be MM not mm. ($date = get-Date -f “yyyymmdd” should be yyyyMMdd) Otherwise you will get minutes.