探查模組:IsFeatureInstalled
適用於: Operations Manager 2007, Operations Manager 2007 R2, Windows 2000 Server, Windows Server 2003, Windows Server 2008, Windows Server 2008 R2
Microsoft.Windows.Server.IsFeatureInstalled.Probe 會檢查執行 Windows Server 2008 (含) 以後版本伺服器作業系統的電腦上是否已安裝指定的功能。開發人員可以使用此模組來探索已安裝的功能。
模組
識別碼 |
Microsoft.Windows.Server.IsFeatureInstalled.Probe |
類型 |
ProbeActionModuleType |
MP |
Microsoft.Windows.Server.Library |
RunAs |
System.PrivilegedMonitoringAccount |
存取範圍 |
Public |
輸入 (設定)
名稱 | 類型 | 描述 | 可覆寫 |
---|---|---|---|
TimeoutSeconds |
int |
逾時 (秒) |
否 |
TargetComputerName |
string |
目標電腦名稱 |
否 |
ServerFeature |
string |
伺服器元件識別碼或名稱。 ServerFeature 屬性的可能值對應至 WMI 類別 Win32_ServerFeature (https://go.microsoft.com/fwlink/?LinkId=119210) (英文) 的 ID 或 Name 屬性值。如果 ServerFeature 是有效整數,則此模組會嘗試先依照 ID 再依照 Name 來搜尋特定功能/角色。 > [!IMPORTANT] > Win32_ServerFeature::Name 未對應至 Win32_ServerFeature::ID 文件中提供的描述欄位。有個判斷實際名稱的方法,就是執行servermanagercmd.exe -q ,然後在輸出中尋找名稱。不過,這也有風險,那就是在未來的作業系統版本中,Win32_ServerFeature::Name 也可能會變更而不另外通知。
>
|
否 |
範例程式碼
下列探索和資料來源模組類型會探索 Windows Server 2008 上的傳真伺服器 (ID = 5):
<DataSourceModuleType ID="Windows.Fax.Server.Discovery.DataSource" RunAs="System!System.PrivilegedMonitoringAccount" Accessibility="Internal">
<Configuration>
<xsd:element minOccurs="1" name="IntervalSeconds" type="xsd:unsignedInt" />
<xsd:element minOccurs="1" name="TimeoutSeconds" type="xsd:unsignedInt" />
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="Scheduler" TypeID="System!System.Discovery.Scheduler">
<Scheduler>
<SimpleReccuringSchedule>
<Interval Unit="Seconds">$Config/IntervalSeconds$</Interval>
</SimpleReccuringSchedule>
<ExcludeDates />
</Scheduler>
</DataSource>
<ProbeAction ID="Probe" TypeID="WindowsServer!Microsoft.Windows.Server.IsFeatureInstalled.Probe">
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<TargetComputerName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</TargetComputerName>
<!--It is possible to pass the feature/role name instead of its ID-->
<ServerFeature>5</ServerFeature><!--"Fax Server"-->
<!--<ServerFeature>Fax Server</ServerFeature>-->
</ProbeAction>
<ConditionDetection ID="Mapper" TypeID="System!System.Discovery.ClassSnapshotDataMapper">
<ClassId>$MPElement[Name="Windows.Fax.Server"]$</ClassId>
<InstanceSettings>
<Settings>
<Setting>
<Name>$MPElement[Name="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Name>
<Value>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Setting>
<Setting>
<Name>$MPElement[Name="System!System.Entity"]/DisplayName$</Name>
<Value>Fax Server</Value>
</Setting>
</Settings>
</InstanceSettings>
</ConditionDetection>
</MemberModules>
<Composition>
<Node ID="Mapper">
<Node ID="Probe">
<Node ID="Scheduler" />
</Node>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.Discovery.Data</OutputType>
</DataSourceModuleType>
<Discovery ID="Windows.Fax.Server.Discovery" Enabled="true" Target="Server2008!Microsoft.Windows.Server.2008.OperatingSystem" ConfirmDelivery="true" Remotable="true" Priority="Normal">
<Category>Custom</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Windows.Fax.Server" />
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows.Fax.Server.Discovery.DataSource">
<IntervalSeconds>60</IntervalSeconds>
<TimeoutSeconds>360</TimeoutSeconds>
</DataSource>
</Discovery>
相關連結
用於安裝/移除伺服器角色/功能的 ServerManagerCmd.exe 工具:
Windows Management Instrumentation (WMI) Win32_ServerFeature 類別