System Center OMED Hizmeti WriteAction özelliğini devre dışı bırak

Microsoft.SystemCenter.DisableService (WriteActionModuleType)

System Center Operations Manager Dış Veri Kaynağı Hizmetini devre dışı bırakmaya ve güvenlik duvarı bağlantı noktasını kapatmaya yönelik Yazma Eylemi

Element properties:

TypeWriteActionModuleType
IsolationAny
AccessibilityPublic
RunAsDefault
InputTypeSystem.BaseData

Member Modules:

ID Module Type TypeId RunAs 
DisableService WriteAction Microsoft.Windows.PowerShellWriteAction Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
TimeoutSecondsint$Config/TimeoutSeconds$TimeoutSeconds

Source Code:

<WriteActionModuleType ID="Microsoft.SystemCenter.DisableService" Accessibility="Public" Batching="false">
<Configuration>
<xsd:element name="TimeoutSeconds" type="xsd:integer" minOccurs="0"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="TimeoutSeconds" ParameterType="int" Selector="$Config/TimeoutSeconds$"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<WriteAction ID="DisableService" TypeID="Windows!Microsoft.Windows.PowerShellWriteAction">
<ScriptName>DisableService.ps1</ScriptName>
<ScriptBody><Script>
$FirewallRuleName = "System Center Operations Manager External DataSource Service"
$ServiceName = "OMED"
try{
$Service = Get-Service -Name $ServiceName -ErrorAction Stop
}Catch{
Write-Host "OMED Service is not Installed."
exit
}
$Port = 8886
$CleanupPort = $TRUE
if($Service.Status -eq "Running" -or $Service.StartType -ne "Disabled")
{
Set-Service $ServiceName -StartupType "Disabled"
Write-Host "OMED Service changed to disabled."
$Service = Get-Service -Name $ServiceName
Write-Host "Stopping OMED service."
Stop-Service $ServiceName
$TimeOut = 10000
Start-Sleep -m $TimeOut
$Service = Get-Service -Name $ServiceName
if ($Service.Status -eq "Running")
{
Write-Host "OMED Service was not stopped."
Write-Host "Stop OMED service Manually."
$CleanupPort = $FALSE;
} else {
Write-Host "OMED Service stopped successfully."
}
}else{
Write-Host "OMED Service is not Running."
}
if ($CleanupPort) {
try{
Remove-NetFirewallRule -DisplayName $FirewallRuleName
Write-Host "Port" $Port "closed"
}Catch {
Write-Host "Port" $Port "cleanup failed"
}
}
</Script></ScriptBody>
<Parameters/>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<StrictErrorHandling>true</StrictErrorHandling>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="DisableService"/>
</Composition>
</Composite>
</ModuleImplementation>
<InputType>System!System.BaseData</InputType>
</WriteActionModuleType>