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 snippet
5. Code is prepopulated
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