SCOM 2012 Powershell Script to Backup Unsealed Management Packs

Sure there’s plenty out there already. But my does it out of the box. Run it from wherever on the management server and it will create a folder called C:\UnsealedBackup\<date> and dump the unsealed management packs in there. Nice and neat, run it every day after you eat your Wheaties. Or just schedule it with Task Scheduler. But either way, Wheaties are tasty.

# Written by J. Clarke to automated the backup of unsealed management packs.
# Version 1.0
Import-Module OperationsManager
$Date = Get-Date -Format “yyyy-MM-dd”
$TodaysFolder = “C:\UnsealedBackup\” + $Date
New-Item $TodaysFolder -type directory -force
Get-SCOMManagementPack | where {$_.Sealed -eq $false} | export-SCOMmanagementpack -path $TodaysFolder

Add a CSV list of users to an AD group with powershell

I love Quest’s powershell cmdlets for AD. They have added a ton of productivity improvement to my life. Since I was used to writing scripts in VB and using dsquery and dsmod, it wasn’t a fast process, but eventually I started to get the hang of the syntax and boolean changes. Here is one quick super easy script that has recently saved me a bunch of time. Keep in mind you have to have the Active Roles Management Shell for AD installed, which is a free plugin released by Quest, otherwise you won’t be able to add the snapin with the first line.

add-PSSnapin quest.activeroles.admanagement -erroraction SilentlyContinue
Get-Content “C:\Powershell\listofusers.csv” | Add-QADGroupMember “Security Group Name”

All that is in that CSV is a list of SAM account names in the first column. Quick and easy.