Using PowerShell ISE snippets to connect to SCOM

As you probably know PowerShell ISE snippets are great. If you do not know you can check this post.

Since I am connecting to SCOM through PowerShell a lot and I am lazy, I created a snippet so I do not have to type it each and every time.

The process goes as follows:
1. Open PowerShell ISE
2. Hit Ctrl+J
3. Browse for previously created snippetctrljselectsnippet
5. Code is prepopulatedpopulatedscomconnectionsnippet01
4. Run it with F5

And we are ready to rock roll:

If you find this idea useful, here is a code you have to paste and run it in PowerShell ISE to create a snippet (just modify credentials and OpsMgr Server name):

$NameOfSnippet = "ScomConnection"
$Description = "Connection to SCOM"

$Snippet = @'
$Creds = Get-Credential CONTOSO\homer.simpson
$MsName = "ScomServer01"

New-SCOMManagementGroupConnection -ComputerName $MsName -Credential $Creds
'@

New-IseSnippet -Title $NameOfSnippet -Description $Description   -Text $Snippet

Till next time
Jure

Advertisements
This entry was posted in Operations Manager, PowerShell and tagged , , , , , . Bookmark the permalink.

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