|
随着企业内部IT基础架构建设的不断推进,服务器的数量不断增加,系统管理员发现原先采取的“人盯机器”的方法变得越来越困难。因此相信大家或多或少都听说过SCOM这款产品,SCOM主要帮助系统管理员实现对服务器的自动化监控,帮助系统管理员及时应对各种突发情况。而PowerShell则在SCOM 2007中便被引入进来,用来加速系统管理员的操作,因此,从今天开始,我将为大家介绍如何使用System Center Operations Manager 2007 R2(SCOM)中的PowerShell命令。
首先还是老规矩,按照我们之前学习PowerShell AD模块时学到的好习惯,先来看看SCOM 2007 R2中一共实现了多少项PowerShell命令。当然再看之前,我们必须知道启动SCOM PowerShell命令的方式,这里同AD Module有所不同的是,我们必须通过SCOM安装程序创建的快捷方式打开SCOM PowerShell管理控制台。这是因为很多SCOM PowerShell命令都必须输入Path参数。虽然你可以通过以下两条命令来在普通的PowerShell管理控制台中添加SCOM插件并建立起SCOM的驱动器对象,但是最后你会发现这样的使用方法还是有点问题的,所以我们还是通过默认的快捷方式打开SCOM的PowerShell管理控制台。当然有兴趣的朋友可以研究下SCOM安装目录下的Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Function.ps1文件看下默认的驱动器路径是如何实现的。
Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client
New-PSDrive -Name SCOM -PSProvider OperationsManagerMonitoring -Root \ -Scope Global
在打开SCOM的PowerShell管理控制台后,我们可以通过Get-Command -Module Microsoft.EnterpriseManagement.OperationsManager.Client确认和SCOM有关的命令,最后确认的结果一共有87项。且进一步通过Group-Object进行分组之后,便可以得到以下列表(部分命令): 
这里大家可能会失望一下,因为Group-Object的结果并不是很理想,有很多单个命令出现在最后的返回结果中,这里我们不得不采取手动整理的方法来列出以下表格:
分类名词{命令列表}ManagementGroup
{Get-ManagementGroupConnection, New-ManagementGroupConnection, Remove-ManagementGroupConnection} {Get-DefaultSetting, Set-DefaultSetting} {Get-Connector} ManagementServer
{Get-ManagementServer, Set-ManagementServer} {Get-PrimaryManagementServer} {Get-RootManagementServer} {Get-GatewayManagementServer} {Get-FailoverManagementServer} Tier
{Get-Tier, New-Tier, Remove-Tier} {Remove-ConnectorFromTier} {Add-ConnectorToTier}
MangementPack{Export-ManagementPack, Get-ManagementPack, Install-ManagementPack, Uninstall-ManagementPack} Discovery
{Get-Discovery} {Start-Discovery} {New-WindowsDiscoveryConfiguration} {New-LdapQueryDiscoveryCriteria} {New-DeviceDiscoveryConfiguration}
Agent
{Get-Agent, Install-Agent, Uninstall-Agent} {Install-AgentByName} {Set-ProxyAgent} {Approve-AgentPendingAction, Get-AgentPendingAction, Reject-AgentPendingAction} Remotely
{Add-RemotelyManagedComputer, Get-RemotelyManagedComputer, Remove-RemotelyManagedComputer}{Add-RemotelyManagedDevice, Get-RemotelyManagedDevice, Remove-RemotelyManagedDevice}Monitor{Get-Monitor} {Get-State } {Get-MonitorHierarchy} MonitoringObject
{Get-MonitoringObjectGroup} {Get-MonitoringObject} {Get-MonitoringObjectPath} {Get-MonitoringObjectProperty} {Get-MonitoringClassProperty} {Get-RelationshipObject} {Get-RelationshipClass} {Get-Recovery} {New-MonitoringPropertyValuePair} {Remove-DisabledMonitoringObject} {New-CustomMonitoringObject} {Get-MonitoringClass}
Rule{Disable-Rule, Enable-Rule, Get-Rule}Performance Counter{Get-PerformanceCounterValue} {Get-PerformanceCounter} Override
{Get-ResultantCategoryOverride} {Get-ResultantUnitMonitorOverride}{Get-ResultantRuleOverride} {Get-Override}
Alert{Get-Alert, Resolve-Alert} {Get-AlertDestination, Set-AlertDestination} {Get-AlertHistory} Task
{Get-Task, Start-Task} {Get-TaskResult}
MaintenanceWindow
{Get-MaintenanceWindow, New-MaintenanceWindow, Set-MaintenanceWindow} Notification
{Disable-NotificationSubscription, Enable-NotificationSubscription, Get-NotificationSubscription} {Get-NotificationEndpoint} {Get-NotificationRecipient} {Get-NotificationAction}User {Get-UserRole} {Add-UserToUserRole}
Misc.
{Get-RunAsAccount} {Get-Event} {Get-Diagnostic} {Get-OperationsManagerCommand}
今天是整个系列介绍的第一篇,主要是为大致介绍下SCOM中有哪些可用的PowerShell,详细的介绍将在后续几周中陆续展开,敬请期待。
已发表 2011年5月2日 21:21 作者 ghjconan
归档在:SCOM, PowerShell, OpsMgr
|
|
|