Well not many more entrants that came out of the woodwork….
Bharat Suneja posted a nice entry since the last call….
But the winner is Nick Smith!! who posted this handy dandy little script to the comments of the original post.
Jeffrey, I heard Bruce’s book is almost done, will you be able to get Nick a copy still?
- Here is a script to dynamically detect all databases on an Exchange 2007 server and backup each database with ntbackup.
function perform_backup ([string] $ServerName, [string] $BackupRootDrive) {
$BackupScriptPath = $BackupRootDrive + “BackupScripts\”
$BackupPath = $BackupRootDrive + “DailyBackups\”$BackupScript = $BackupScriptPath + $ServerName + “BackupScript.bat”
$BackupLog = $BackupScriptPath + “ExchangeBackupLogs.log”
new-item $BackupScript -type file -force
new-item $BackupLog -type file -forceAdd-Content $BackupScript “@ECHO off”
#Add registry keys to improve ntbackup performance
#See http://www.microsoft.com/technet/itsolutions/msit/operations/exchbkup.mspx
Add-Content $BackupScript “reg add `”HKCU\Software\Microsoft\Ntbackup\Backup Engine`” /v `”Logical Disk Buffer Size`” /t REG_SZ /d 64 /f”
Add-Content $BackupScript “reg add `”HKCU\Software\Microsoft\Ntbackup\Backup Engine`” /v `”Max Buffer Size`” /t REG_SZ /d 1024 /f”
Add-Content $BackupScript “reg add `”HKCU\Software\Microsoft\Ntbackup\Backup Engine`” /v `”Max Num Tape Buffers`” /t REG_SZ /d 16 /f”Get-MailboxDatabase | where {$_.ServerName -eq $ServerName} | foreach{
$JetBackupSyntax = “JET ” + $_.ServerName + “\Microsoft Information Store\” + $_.StorageGroupName + “\” + $_.AdminDisplayName
$BksFileName = $BackupScriptPath + $_.ServerName + “” + $_.StorageGroupName + “” + $_.AdminDisplayName + “.bks”
$JetBackupSyntax | out-file -filepath $BksFileName -encoding unicode
Add-Content $BksFileName “”
$BksDescriptiveName = $_.ServerName + “_” + $_.StorageGroupName + “_” + $_.AdminDisplayName
$NTBackupLine = “C:\WINDOWS\system32\ntbackup.exe backup `”@” + $BksFileName + “`” /n `”” + $BksDescriptiveName + “`” /d `”” + $BksDescriptiveName + “`” /v:no /r:no /rs:no /hc:off /m normal /fu /j `”” + $BksDescriptiveName + “`” /l:s /f `”” + $BackupPath + $BksDescriptiveName + “.bkf`” ”
Add-Content $BackupScript $NTBackupLine
}
Get-PublicFolderDatabase | where {$_.ServerName -eq $ServerName} | foreach{
$JetBackupSyntax = “JET ” + $_.ServerName + “\Microsoft Information Store\” + $_.StorageGroupName + “\” + $_.AdminDisplayName
$BksFileName = $BackupScriptPath + $_.ServerName + “” + $_.StorageGroupName + “” + $_.AdminDisplayName + “.bks”
$JetBackupSyntax | out-file -filepath $BksFileName -encoding unicode
Add-Content $BksFileName “”
$BksDescriptiveName = $_.ServerName + “_” + $_.StorageGroupName + “_” + $_.AdminDisplayName
$NTBackupLine = “C:\WINDOWS\system32\ntbackup.exe backup `”@” + $BksFileName + “`” /n `”” + $BksDescriptiveName + “`” /d `”” + $BksDescriptiveName + “`” /v:no /r:no /rs:no /hc:off /m normal /fu /j `”” + $BksDescriptiveName + “`” /l:s /f `”” + $BackupPath + $BksDescriptiveName + “.bkf`” ”
Add-Content $BackupScript $NTBackupLine
}
& $BackupScript
}perform_backup “ServerName” “R:\”
October 14, 2006 at 9:28 pm |
Hey there, I’ll keep up my end—entries from my blog, and the ninjas site are forthcoming to announce the winner :) ehlo blog takes time, but I will also do that at the same time we announce the winner for the official MS contest.
Congratulations Nick and nice work to the rest of the entries. Can’t wait to see more.
October 16, 2006 at 3:18 pm |
Hi Josh,
I’ve talked to Manning and we’re going to arrange for Nick to get a copy of the book along with on-line access through the Manning early access program. Send me an email and we’ll get everything set up. Thanks.
-bruce
=================================================
Bruce Payette [MSFT]
Technical Lead, Windows PowerShell
April 9, 2007 at 6:58 am |
[...] old co-worker of mine from the startup days Marcel started blogging, as did the powershell contest winner Nick. Of course Nick is keeping us up to speed with lots of new scripts and tips for you [...]
June 4, 2007 at 4:18 pm |
Hi Jim. Photos i received. Thanks
January 25, 2008 at 9:53 pm |
[...] suggestions on how to give these things away. I previously partnered with Manning press to do the powershell script contest which was fun, but what else would be interesting for a giveaway? Post your ideas in the comments [...]