Understanding SCOM 2012 Alerts and Monitors and how to reactivate a closed Monitor

If you would like to know a bit more about the differences between a SCOM “Rule” and a “Monitor” and why Alerts can be closed and Monitors should not, then read this great article from Cameron Fuller. It describes nicely how to react on Alerts and Monitors in SCOM / OpsMgr 2012 R2 

An alert can typically be closed if the state has not changed for a longer period of time, otherwise there would be a repeat count on the alert if it were still an issue.

Monitors will typically close by them self, if not you would have to reset the health state to close it automaticly.

If you by accident close a Monitor, it will not reappear before the health state changes. Therefore, if you are running out of disk space, the monitor will only reappear when the issue have been resolved and then reappears.

This script can reset the closed monitors, which has been copied from this great article, with a small fix since the script was missing a terminator.

$Alertname=@();
$State=@();
$Displayname=@();
# Import Operations Manager Module and create Connection
Import-Module OperationsManager;
New-SCOMManagementGroupConnection EURSCOMACS01;
$alerts=get-scomalert -Criteria “Severity!=0 AND IsMonitorAlert=1 AND ResolutionState=255” | where {$_.LastModified -ge ((get-date).AddMinutes(-5)).ToUniversalTime()}
if ($alerts -is [object])
{
foreach ($alert in $alerts)
{
$monitoringobject = Get-SCOMClassinstance -id $alert.MonitoringObjectId
# Reset Monitor
If (($monitoringobject.HealthState -eq “Error”) -or ($monitoringobject.HealthState -eq “Warning”))
{
$monitoringobject.ResetMonitoringState()
$State+=$monitoringobject.HealthState
$Displayname+=$monitoringobject.displayname
$Alertname+=$alert.Name
}
}
}

I have verified that it works, but use at your own risk.

/Mads

How to import existing computer objects to a SCCM 2012 collection with PowerShell

 Sometimes you need to add a lot of different already existing computer objects to a Configuration Manager collection.

 If you are lucky, these objects are placed in another collection or in a AD group, BUT – what if you just got a specific list of computers from someone ells that they would like to have updated with a certain application?

 Instead of adding the computer objects manually to the SCCM collection membership, you can add all object to an existing collection using Configuration Manager 2012 PowerShell.

 First: Create a collection in SCCM with the name you like

 Second: save the list of computers in a 1 column CSV file with the computer names only, remove all other information.

PowerShellComputers

 Third: Run this script and change the CSV file name and path and SCCM Collection Name.

$computers = Get-Content “c:\temp\computers.csv” | foreach {Add-CMDeviceCollectionDirectMembershipRule -CollectionName “COLLECTION NAME HERE” -ResourceId $(get-cmdevice -Name $_).ResourceID}

 At Last: Run this PowerShell script in the Configuration Manager Console PowerShell windows – at your own risk –  and please test with a single computer object first!

SCCMConsolePowerShell

I hope this tip will help you save some time.

How to use Powershell Deployment Toolkit – on one laptop

This post is not a step-by-step guide, it is a Collection of informations that i have gathered to make it work for me on one laptop.

Powershell Deployment Toolkit is not perfect, i have experienced a lot of errors, but the latest version 2.5.2509 is better than ever:

The tookit can be downloaded here: http://gallery.technet.microsoft.com/PowerShell-Deployment-f20bb605

Run all scripts in an elevated powershell command promt:

1. Run “Downloader.ps1” to get all required files – will take many hours.

2. Create the two reference OS VHDX files. Server 2012 R2 and Server 2008R2 SP1. All you need is the .ISO file and then follow my other post (EASY!): http://mcloud.info/convert-a-wim-or-iso-file-to-vhdx/

3. Modify the “VariablesAD.XML” with the settings you like, BUT rather move files that change here, the way of success i make as little changes as possible.

4. Change the VariableAD.XML file to Variable.xml and delete the other version.

5. Create the Virtual Switch on your HyperV Manager – Default “CorpNet01” (choose Private, internet access is not required)

6. run “VMCreator.ps1” and it will create all VM’s and push the installation files into the VM’s and the DC01 will be the one to drive the installation, it is save to log in on it when the other VM’s are booting up.

I ran this script on a Dell Pricision M6700 laptop with 32gb og memory and a raid 0 on two SSD drives on Windows 8.1 in a Workgroup. 16gb of memory is pushing it and requires that you pause the VMcreator.ps1 script when it is booting VM’s around half way, so the dynamic memory can drop a bit before resuming the powerhshell script.

So. One laptop, one private (closed) Virtual Network in hyper-v and time.

Troubleshooting PowerShell Deployment Toolkit: http://blogs.technet.com/b/privatecloud/archive/2013/02/27/deployment-troubleshooting-pdt.aspx

Of you want at step by step guide, i can recommend this one: http://adinermie.wordpress.com/2014/01/26/my-experience-with-the-powershell-deployment-toolkit-pdt-part-1-downloader-ps1/