Zoho Banner September 2011

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

4 Comments

  1. EnterpriseAdmins.org » Blog Archive » Directory partition has not been backed up [DC=virtualcenter,DC=vmware,DC=int] says:

    [...] the ADAM/ADLDS instance on my own. I found an excellent article on how to do this in powershell at http://www.open-a-socket.com/index.php/2009/04/21/schedule-backups-of-your-ad-lds-instance-using-dsd…. Here is the actual script that I now run as a scheduled task: $vcenter = [...]

  2. tree says:

    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?

  3. shovin says:

    can u send me the batch file to schdule the adlds instance backup plz..its urgent…plz send it to shovincyriac@gmail.com

Leave a Reply