1

I recently put together a PowerShell Script on a server running Windows Server 2008 R2 that created a dated directory then started Windows Server Backup to make a system state backup. The script is run on a nightly basis and works great.

Wanting to use this on another server, I copied the script over and, after adding the WSB snapin from the powershell command line, only to find that it would not run.

The difference between the two servers is that this new server runs Server 2008 (not R2). Has anyone gotten powershell scripting to work for running backups on Windows Server 2008 with Windows Server Backup? I wonder if the commandlets are different. So far all the docs I find are based around R2.

Here is the script I am using on the R2 server:

$date = Get-Date -format MMddyyyyHHmm
$policy = New-WBPolicy
$volume = Get-WBVolume -AllVolumes
$backupLocation = New-WBBackupTarget -NetworkPath "\\NAS01\backup\RDP01\$date"

New-Item "\\NAS01\backup\RDP01\$date" -type directory

Add-WBVolume -Policy $policy -Volume $volume 
Add-WBSystemState $policy 
Add-WBBareMetalRecovery $policy 
Add-WBBackupTarget -Policy $policy -Target $backupLocation 
Set-WBVssBackupOptions -Policy $policy -VssCopyBackup 
Start-WBBackup -Policy $policy

Anyone know if there is something different I should be doing on Server 2008 to make this work or is running backups from powershell simply not supported except on R2?

3 Answers 3

1

I am not familiar with those cmdlets exactly, but the issue may be that your Win 2008 box is running Powershell v1.0 and your Win 2008 R2 box is running v2.0. v1.0 is an optional component in Win 2008 and you may need to install v2.0 to get these cmdlets to work. You can confirm which version is installed on each box by opening powershell and typing $host.

From http://en.wikipedia.org/wiki/Windows_PowerShell:

Version 1.0 was released in 2006 for Windows XP SP2/SP3, Windows Server 2003, and Windows Vista. For Windows Server 2008, it is included as an optional feature.

Version 2.0 is integrated with Windows 7 and Windows Server 2008 R2 and is released for Windows XP with Service Pack 3, Windows Server 2003 with Service Pack 2 and Windows Vista with Service Pack 1.

1

You likely need to upgrade to Powershell v2 on the 2008 server. The information about Windorws Mgmt Framework v2 is here

If you are receiving a specific error, let us know.

0

I think this might have something to do with the cmdlets being different in regards to Windows Server Backup on 2008 and 2008 R2. Did a "get-command -module windows.serverbackup" and got the following cmdlets on the 2008 server:

Add-WBBackupTarget
Add-WBVolume
Get-WBBackupTarget
Get-WBDisk
Get-WBPolicy
Get-WBSchedule
Get-WBSummary
Get-WBVolume
New-WBBackupTarget
New-WBPolicy
Remove-WBBackupTarget
Remove-WBPolicy
Remove-WBVolume
Set-WBPolicy
Set-WBSchedule

I ran the same command on an R2 server and got these:

Add-WBBackupTarget
Add-WBBareMetalRecovery
Add-WBFileSpec
Add-WBSystemState
Add-WBVolume
Get-WBBackupSet
Get-WBBackupTarget
Get-WBBareMetalRecovery
Get-WBDisk
Get-WBFileSpec
Get-WBJob
Get-WBPolicy
Get-WBSchedule
Get-WBSummary
Get-WBSystemState
Get-WBVolume
Get-WBVssBackupOptions
New-WBBackupTarget
New-WBFileSpec
New-WBPolicy
Remove-WBBackupTarget
Remove-WBBareMetalRecovery
Remove-WBFileSpec
Remove-WBPolicy
Remove-WBSystemState
Remove-WBVolume
Set-WBPolicy
Set-WBSchedule
Set-WBVssBackupOptions
Start-WBBackup

Note that the number of R2 cmdlets is greater than that of the plain 2008 server. I think this is the problem. The command that sticks out most is that the 2008 server lacks the "Start-WBBackup" command, which is needed to execute a backup. Interesting. Looks like I am going back to the WBadmin tool and running this stuff as a batch on my 2008 servers and saving powershell for 2008 R2

2
  • Will do as soon as the 24 hour limit expires. Thanks for your help on this one! Sep 15, 2011 at 17:19
  • ahh np - I was unaware of that
    – August
    Sep 15, 2011 at 17:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .