Add ESXiSeed Host Server Probe Action

Fujitsu.Servers.PRIMERGY.ESXiSeed.AddHostServer.Probe (ProbeActionModuleType)

Element properties:

TypeProbeActionModuleType
IsolationAny
AccessibilityPublic
RunAsDefault
InputTypeSystem.BaseData
OutputTypeSystem.PropertyBagData

Member Modules:

ID Module Type TypeId RunAs 
PA ProbeAction Microsoft.Windows.PowerShellPropertyBagProbe Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
HostServerstring$Config/HostServer$Host ServerPrincipal Name of ESXiSeed Host Server to add
ListenPortint$Config/ListenPort$Listen PortListen Port of ESXi CIM Indications Listener service
ListenProtocolstring$Config/ListenProtocol$Listen ProtocolListen Protocol of ESXi CIM Indications Listener service
TimeoutSecondsint$Config/TimeoutSeconds$Timeout SecondsTimeout for AddHostServer PoSh script

Source Code:

<ProbeActionModuleType ID="Fujitsu.Servers.PRIMERGY.ESXiSeed.AddHostServer.Probe" Accessibility="Public">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HostServer" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ListenPort" type="xsd:int"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ListenProtocol" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TimeoutSeconds" type="xsd:int"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="HostServer" Selector="$Config/HostServer$" ParameterType="string"/>
<OverrideableParameter ID="ListenPort" Selector="$Config/ListenPort$" ParameterType="int"/>
<OverrideableParameter ID="ListenProtocol" Selector="$Config/ListenProtocol$" ParameterType="string"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<ProbeAction ID="PA" TypeID="Windows!Microsoft.Windows.PowerShellPropertyBagProbe">
<ScriptName>AddHostServerTask.ps1</ScriptName>
<ScriptBody><Script>
#-------------------------------------------------------------------
# Fujitsu
# Copyright 2015-2017 FUJITSU LIMITED
#
# AddHostServerProbe.ps1
#
# Summary:
# Script adds Fujitsu PRIMERGY ESXi Host Server registry informations.
#
#-------------------------------------------------------------------

param (
[string] $HostServer,
[string] $PrincipalName,
[string] $ListenPort,
[string] $ListenProtocol,
[switch] $OutsideManagementPack
)

$script:MPScriptVersion = "8.3.3.0"

$script:RootRegistryKey = "HKLM:\SOFTWARE\Fujitsu\ServerView Suite\SCOM Integration\SVISCOM-ESXi"
$script:RegKeyCIMListener = "CIMIndicationsListener"
$script:ValueListenPort = "ListenPort"
$script:ValueListenProtocol = "ListenProtocol"
$script:ValueDeployStatus = "DeployStatus"
$script:ValueVersion = "ProductVersion"

$StatusAwaitingInstallation = "AwaitingInstallation"
$StatusAwaitingReinstallation = "AwaitingReinstallation"

function Main {
if ($HostServer -eq $PrincipalName) {
if (! (Test-Path -Path "$RootRegistryKey\$RegKeyCIMListener")) {
New-Item -Path "$RootRegistryKey\$RegKeyCIMListener" -Force
}

$ver = Get-RegValue $ValueVersion
$port = Get-RegValue $ValueListenPort
$protocol = Get-RegValue $ValueListenProtocol
$status = Get-RegValue $ValueDeployStatus

if (($ver -eq $null) -or ($status -eq $StatusAwaitingInstallation)) {
Set-ItemProperty -Path "$RootRegistryKey\$RegKeyCIMListener" -Name $ValueListenPort -Type String -Value $ListenPort -Force
Set-ItemProperty -Path "$RootRegistryKey\$RegKeyCIMListener" -Name $ValueListenProtocol -Type String -Value $ListenProtocol -Force
Set-ItemProperty -Path "$RootRegistryKey\$RegKeyCIMListener" -Name $ValueDeployStatus -Type String -Value $StatusAwaitingInstallation -Force
Set-ItemProperty -Path "$RootRegistryKey\$RegKeyCIMListener" -Name $ValueVersion -Type String -Value $MPScriptVersion -Force
} elseif (($ver -lt $MPScriptVersion) -or ($port -ne $ListenPort) -or ($protocol -ne $ListenProtocol)) {
Set-ItemProperty -Path "$RootRegistryKey\$RegKeyCIMListener" -Name $ValueListenPort -Type String -Value $ListenPort -Force
Set-ItemProperty -Path "$RootRegistryKey\$RegKeyCIMListener" -Name $ValueListenProtocol -Type String -Value $ListenProtocol -Force
Set-ItemProperty -Path "$RootRegistryKey\$RegKeyCIMListener" -Name $ValueDeployStatus -Type String -Value $StatusAwaitingReinstallation -Force
Set-ItemProperty -Path "$RootRegistryKey\$RegKeyCIMListener" -Name $ValueVersion -Type String -Value $MPScriptVersion -Force
}
}
}

function Get-RegValue {
param ( [string] $Name )

try {
return (Get-ItemProperty "$RootRegistryKey\$RegKeyCIMListener" -Name $Name -Ea Stop).$Name
} catch {
}

return $null
}

Main
</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>HostServer</Name>
<Value>$Config/HostServer$</Value>
</Parameter>
<Parameter>
<Name>PrincipalName</Name>
<Value>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Parameter>
<Parameter>
<Name>ListenPort</Name>
<Value>$Config/ListenPort$</Value>
</Parameter>
<Parameter>
<Name>ListenProtocol</Name>
<Value>$Config/ListenProtocol$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="PA"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
<InputType>System!System.BaseData</InputType>
</ProbeActionModuleType>