Additions to the script

Feb 23, 2009 at 6:03 PM
Edited Feb 23, 2009 at 6:05 PM
After I downloaded 1.1 and finding it so useful, I made a few additions myself to the current script.  You already added the IIS detection for 6 and 7 but you might want to add the Alternate Access Mappings, GAC and replace the Zip function.  I will include some of the snippets here if you like or you can also contact me and I will email you my changes.

Alternate Access Mappings

 

Added element in the XML configuration and modified the portion of the script which reads the XML to include

$aambackup

 

 

= $item.aambackup

 

 

 

 

# ---

# --- Do a Alternate Access Mappings backup if aambackup=1 ---
# ---

 

 

If ([string]::Compare($aambackup, "0", $True))
{
$jobreport = logging("Starting backup of Alternate Access Mappings to "+$backupdestination+"\"+$backupfilename+"-aam"+$guid+".xml")
if(test-path $backupdestination) {
&
$hive\BIN\stsadm.exe -o enumalternatedomains >> $backupdestination"\"$backupfilename"-aam"$guid.xml
[
DateTime]::Now.ToString() + ": Alternate Access Mappings backup Done! File name is $backupdestination\$backupfilename-aam$guid.xml" >> "$backupdestination\log.txt"
}
else
{
$jobstatus = "Error"
$jobreport = logging("Error: The backupdestination Path doesn't exist for site id "+$id)
}
}
else
{
$jobreport = logging("Skipping backup of Alernate Access Mappings.")
}

Global Assembly Cache

Added element in the xml configuration file and modified the portion of the script which reads the XML to include

$gacbackup = $item.gacbackup
$gac = $env:windir+"\assembly\gac_msil\"

 

 

 

 

 

# ---

 

 

# --- Do a GAC backup if gacbackup=1 ---
# ---

 

 

 

 

If ([string]::Compare($gacbackup, "0", $True))
{
$jobreport = logging("Starting backup of GAC to "+$backupdestination+"\"+$backupfilename+"-gac"+$guid+".zip")
if(test-path $backupdestination)
{
if(test-path $gac)
{
Write-Zip -Path
$gac -IncludeEmptyDirectories -OutputPath $backupdestination\$backupfilename"-gac"$guid".zip" > $null
[DateTime]::Now.ToString() + ": GAC backup Done! File name is $backupdestination\$backupfilename-gac$guid.zip" >> "$backupdestination\log.txt"
}
else
{
$jobstatus = "Error"
$jobreport = logging("Error: The GAC Path doesn't exist for site id "+$id)
}
}
else
{
$jobstatus = "Error"
$jobreport = logging("Error: The backupdestination Path doesn't exists for site id "+$id)
}
}
else
{
$jobreport = logging("Skipping backup of GAC "+$gac)
}

These additions made the script adhere more closely to the Disaster and Recovery Guide from Microsoft.

 

Apr 28, 2009 at 1:32 PM
Jesper, are these additions planned to be included in the next version?