Unsealed MP Backup SCOM 2012 · PDF fileUnsealed MP Backup SCOM 2012 ... Step7: Right click...

11
Unsealed MP Backup SCOM 2012 When Operations Manager has been up and running, a couple of overrides MPs (Custom or Unsealed MP) we are creating that we don´t want to lose and backup is mandatory on schedule or whenever we made changes. The script looks after all unsealed Management Packs and then exports them to a file-path that´s specified in the script (D:\SCOMCUSTOMPBackup). Then the script can schedule by using Task Scheduler. It needs a folder to run in, e.g. D:\SCOMCUSTOMPBackup\SCOMCUSTOMMPBackup.ps1 Step1: Create One Folder Named SCOMCUSTOMPBackup to D:\ of Management Server. Step2: Open PowerShell as Run as Administrator

Transcript of Unsealed MP Backup SCOM 2012 · PDF fileUnsealed MP Backup SCOM 2012 ... Step7: Right click...

Page 1: Unsealed MP Backup SCOM 2012 · PDF fileUnsealed MP Backup SCOM 2012 ... Step7: Right click Task ... Microsoft Word - Unsealed MP Backup SCOM 2012.docx

Unsealed MP Backup SCOM 2012

When Operations Manager has been up and running, a couple of overrides MPs (Custom or

Unsealed MP) we are creating that we don´t want to lose and backup is mandatory on schedule

or whenever we made changes.

The script looks after all unsealed Management Packs and then exports them to a file-path

that´s specified in the script (D:\SCOMCUSTOMPBackup). Then the script can schedule by using

Task Scheduler. It needs a folder to run in, e.g. D:\SCOMCUSTOMPBackup\SCOMCUSTOMMPBackup.ps1

Step1: Create One Folder Named SCOMCUSTOMPBackup to D:\ of Management Server.

Step2: Open PowerShell as Run as Administrator

Page 2: Unsealed MP Backup SCOM 2012 · PDF fileUnsealed MP Backup SCOM 2012 ... Step7: Right click Task ... Microsoft Word - Unsealed MP Backup SCOM 2012.docx

Step3: Run below PS Script.

Import-Module OperationsManager

New-SCOMManagementGroupConnection -ComputerName $ManagementServer

$Date = Get-Date -Format "yyyy-MM-dd"

$TodaysFolder = "D:\SCOMCUSTOMPBackup\SCOMCUSTOMPBackup" + $Date

New-Item $TodaysFolder -ItemType directory -Force

$mp = Get-SCOMManagementPack | where {$_.Sealed -like "False"}

Export-SCOMManagementPack -ManagementPack $mp -Path $TodaysFolder

Set-Location -Path $TodaysFolder

Optional Script Line

• To optionally save the Backup folder to a network share

Copy-Item $TodaysFolder -Recurse \\AWISCCM\scomcustommpbackup$

• To delete the backup folder older than 3 month

Page 3: Unsealed MP Backup SCOM 2012 · PDF fileUnsealed MP Backup SCOM 2012 ... Step7: Right click Task ... Microsoft Word - Unsealed MP Backup SCOM 2012.docx

get-childitem "D:\SCOMCUSTOMPBackup" |? {$_.psiscontainer -and

$_.lastwritetime -le (get-date).addmonths(-3)} |% {remove-item $_ -force -whatif}

Step4: Verify the Unsealed MP Backup

Page 4: Unsealed MP Backup SCOM 2012 · PDF fileUnsealed MP Backup SCOM 2012 ... Step7: Right click Task ... Microsoft Word - Unsealed MP Backup SCOM 2012.docx
Page 5: Unsealed MP Backup SCOM 2012 · PDF fileUnsealed MP Backup SCOM 2012 ... Step7: Right click Task ... Microsoft Word - Unsealed MP Backup SCOM 2012.docx

Unsealed MP Backup SCOM 2012 Automatically through Task Scheduler

Step5: We can also create task by using Windows Task Scheduler to Back up all the Unsealed

MP at the end of Month as below.

Step6: Open the Task Scheduler on Management Server

Step7: Right click Task Scheduler Library and click Create Task

Page 6: Unsealed MP Backup SCOM 2012 · PDF fileUnsealed MP Backup SCOM 2012 ... Step7: Right click Task ... Microsoft Word - Unsealed MP Backup SCOM 2012.docx

Step8: In the General pane, Mark Run whether user is logged on or not and Run with highest

Privileges Configure as below.

Page 7: Unsealed MP Backup SCOM 2012 · PDF fileUnsealed MP Backup SCOM 2012 ... Step7: Right click Task ... Microsoft Word - Unsealed MP Backup SCOM 2012.docx

Step9: In the Trigger pane, set the schedule as below.

Step10: On the Actions pane, New and then leave start a program as it is..

Step11: In Program/Script, Enter c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Which is the default path to Powershell.exe

Step12: In Arguments, paste the following cmd, edit the file-path to where you placed the script, and

set your own Management Server name and Click OK.

-Command "& d:\SCOMCUSTOMPBackup\SCOMCUSTOMMPBackup.ps1 -ServerName

'AWISCOM' ; exit $LASTEXITCODE"

SCOMCUSTOMMPBackup.ps1

Page 8: Unsealed MP Backup SCOM 2012 · PDF fileUnsealed MP Backup SCOM 2012 ... Step7: Right click Task ... Microsoft Word - Unsealed MP Backup SCOM 2012.docx
Page 9: Unsealed MP Backup SCOM 2012 · PDF fileUnsealed MP Backup SCOM 2012 ... Step7: Right click Task ... Microsoft Word - Unsealed MP Backup SCOM 2012.docx

Step13: Click OK and enter the password for the service account to create the task.

Page 10: Unsealed MP Backup SCOM 2012 · PDF fileUnsealed MP Backup SCOM 2012 ... Step7: Right click Task ... Microsoft Word - Unsealed MP Backup SCOM 2012.docx

Step14: Now when the task is created, you can test run the task by right clicking it and choose Run.

Step15: Now, check the folder you created earlier and your unsealed management packs

should now be exported to a folder matching today`s date.

Page 11: Unsealed MP Backup SCOM 2012 · PDF fileUnsealed MP Backup SCOM 2012 ... Step7: Right click Task ... Microsoft Word - Unsealed MP Backup SCOM 2012.docx