new-blogentry -topic "Powershell and More"

My observations about Powershell, Windows, System Center and life.

Recent comments

Tags

Don't show

    Disclaimer

    Any opinions expressed herein are completely accidental. But if one happens to slip in, it represents my own personal opinion and NO one elses. I'm also not concerned with changing anyone elses opinion, so any rants about anything presented on this site are likely to be 100% ignored.

    © Copyright 2010

    Operations Manager Command Shell

    I run Windows 2008 64bit on my main workstation, so when I installed the Operations Manager Console and Command Shell for remote administration of OpsMgr, it only added the snapin for 64bit Powershell. However, I generally use Powershell Plus (which is 32bit only), and thus couldn’t access the Operations Manager Command Shell stuff from my normal environment.

    InstallUtil didn’t work against Microsoft.EnterpriseManagement.OperationsManager.ClientShell.dll, so I resigned myself to using the native powershell console.

    Until now. By using Add-Module from Powershell v2 CTP2, I was able to load the DLL and provide access to the cmdlets for Operations Manager. I’m NOT a developer and have no idea what’s going on underneath. So here’s the script I use to initialize the Operations Manager Command Shell in my 32bit Powershell Plus environment. I’ll leave it to someone like Joel to explain just WHY this works! It’s also possible this doesn’t provide 100% functionality, but so far everything I’ve tried has worked.

    param ( $OpsmgrPath = "C:\Program Files\System Center Operations Manager 2007\", $ManagementServer = "", $SavePrompt = $true ) if (Test-Path $opsmgrpath) { if ($SavePrompt) { $pr = gc function:prompt } $shelldll = "Microsoft.EnterpriseManagement.OperationsManager.ClientShell.dll" $functionpath = "Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Functions.ps1" Add-Module $(Join-Path $opsmgrpath $shelldll) &$(Join-Path $opsmgrpath $functionpath) Start-OperationsManagerClientShell -ManagementServerName: $ManagementServer -PersistConnection: $true -Interactive: $true; if ($SavePrompt) { $pr | sc function:prompt } } else { Write-Host -foregroundcolor yellow "Unable to find the Operations Manager Install Directory. Pass the correct Install Direcotry with the -OpsmgrPath argument." }

    Posted by gaurhoth on Sunday, September 28, 2008 12:32 PM
    E-mail | Permalink | Comments (36) | Post RSSRSS comment feed