Home > OM12, OM12 Powershell > Create SCOM 2012 Subscribers with PowerShell Redux!

Create SCOM 2012 Subscribers with PowerShell Redux!

Just when you thought it couldn’t get easier to create a truck load of subscribers, I happened to bump into this nice blog article from the Scripting Guys about how can I read a csv file? http://blogs.technet.com/b/heyscriptingguy/archive/2008/10/13/how-can-i-read-a-csv-file.aspx

Seeing the one liner made me think of the last blog article I wrote on creating subscribers in OpsMgr 2012, so naturally I stayed up extra late to put the two together.

The data source will be a csv file with the following Header and information:

Name,Email,sms,sip

Joe Blow, Joe.Blow@Company.com, sms:7708675309, sip:joeblow

Nancy Cowlick, NCOWLICK@company.com, sms:4048675309, sip:NancyCowlick

Nick Danger, NDanger@company.com, sms:6788675309, sip:NickDanger

Wow-Wow Wzby, Wzby@company.com, sms:7048675309, sip:Wow-WowWzby

BLA BLA, BLA.BLA@company.com, sms:8038675309, sip:Blabla

The script is very similar to the hey scripting guys article above.

#Begin of Script

$path = "C\TEMP\email.csv"

Import-csv -path $path |

foreach-object `

{

  Add-SCOMNotificationSubscriber -Name $_.Name -DeviceList $_.Email, $_.sms, $_.sip

}

#End of script

I hope this saves someone some time in the near future!

Advertisements
Categories: OM12, OM12 Powershell
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: