The Command Shell is an Operations Manager specific implementation of PowerShell. PowerShell of course is Microsoft’s extensible command line interface and scripting language, available for Windows XP SP2, Windows Server 2003, Windows Vista, and part of Windows Server 2008.
The beauty of PowerShell is that it can access data in different data stores via providers, using the same syntax. PowerShell also has a hosting mechanism allowing the runtime to be imbedded inside other applications. This enables those applications to utilize PowerShell’s functionality for performing operations, while using a superset with cmdlets specific to each application. These applications include Exchange 2007, SQL Server 2008, Operations Manager 2007 and other System Center applications including Virtual Machine Manager and Data Protection Manager.
How does this work for OpsMgr? You invoke the Command Shell either by going through the Start menu (Start -> System Center Operations Manager 2007 -> Command Shell) which invokes PowerShell while loading the Operations Manager extensions.
Using the Command Shell you can use the get-momcommand cmdlet to get a list of Operations Manager 2007 cmdlets and the get-Help cmdlet to display help for each cmdlet.
For a batch environment, you can load the extensions themselves. The following code initiates a connection to the Root Management Server (RMS) and loads the OpsMgr PowerShell extensions:
param ($ServerName)
add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client";
set-location "OperationsManagerMonitoring::";
new-managementGroupConnection -ConnectionString:$ServerName;
set-location $ServerName;
To learn more about PowerShell, start with http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx. You can also search the web for numerous blogs, articles, and books that cover PowerShell. System Center Operations Manager 2007 Unleashed also includes examples of using PowerShell for OpsMgr administrative tasks.
Kerrie Meyler, a Microsoft MOM MVP, is an independent consultant and trainer with more than 15 years of Information Technology experience. A previous senior technology specialist at Microsoft, she focused on infrastructure and management solutions, presenting at numerous product launches. More recently, she presented on Operations Manager 2007 and gave several podcasts at TechEd 2007.
Kerrie has worked with Microsoft Learning to develop Microsoft Official Curriculum (MOC) for several courses, including the Implementing Microsoft Operations Manager 2000 course, and did the beta teach for that course.
Kerrie is the lead author of Microsoft Operations Manager 2005 Unleashed and Microsoft System Center Operations Manager 2007 Unleashed
Check out an excerpt from System Center Operations Manager 2007 Unleashed, Chapter 3: Looking Inside OpsMgr.
|
|