Control NLB Node Write Action

Microsoft.Windows.NetworkLoadBalancing.ControlNode.WriteAction (WriteActionModuleType)

Element properties:

TypeWriteActionModuleType
IsolationAny
AccessibilityInternal
RunAsMicrosoft.Windows.NetworkLoadBalancing.PrivilegedAccount
InputTypeSystem.BaseData
OutputTypeSystem.CommandOutput

Member Modules:

ID Module Type TypeId RunAs 
Script WriteAction Microsoft.Windows.ScriptWriteAction Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
TimeoutSecondsint$Config/TimeoutSeconds$Timeout(sec)

Source Code:

<WriteActionModuleType ID="Microsoft.Windows.NetworkLoadBalancing.ControlNode.WriteAction" Accessibility="Internal" RunAs="Microsoft.Windows.NetworkLoadBalancing.PrivilegedAccount" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="NodeName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="ComputerPrincipalName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="TimeoutSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="Command" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="EventID" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="EventMessage" type="xsd:string"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<WriteAction ID="Script" TypeID="Windows!Microsoft.Windows.ScriptWriteAction">
<ScriptName>ControlNLBNodeStatus.vbs</ScriptName>
<Arguments>$Config/NodeName$ $Config/ComputerPrincipalName$ $Config/Command$ $Config/EventID$ $Config/EventMessage$ "ControlNLBNodeStatus.vbs"</Arguments>
<ScriptBody><Script>'Copyright (c) Microsoft Corporation. All rights reserved.

SetLocale("en-us")

'==========================================================================
' Main
'==========================================================================
Dim oAPI
Dim nodeIdentifier
Dim computerName
Dim nodesColl
Dim command
Dim eventID
Dim eventMessage
Dim eventSeverity

nodeIdentifier= WScript.Arguments(0)
computerName = WScript.Arguments(1)
command = WScript.Arguments(2)
eventID = WScript.Arguments(3)
eventMessage = WScript.Arguments(4)
scriptName = WScript.Arguments(5)

'4 means informational event
eventSeverity = 4

if command &lt;&gt; "Stop" AND command &lt;&gt; "Start" Then
WScript.Echo "Invalid command specified: " + command
WScript.Quit
End If

Set oAPI = CreateObject("MOM.ScriptAPI")

Set objNLBProvider = GetObject("winmgmts:\\" &amp; computerName &amp; "\root\MicrosoftNLB")

wql = "SELECT * FROM MicrosoftNLB_Node WHERE Name='" &amp; nodeIdentifier &amp; "'"

Set nodesColl = objNLBProvider.ExecQuery(wql)

If nodesColl.Count = 1 Then
Dim node
Set node = nodesColl.ItemIndex(0)

If command = "Stop" Then
WScript.Echo "Stopping NLB node"
node.Stop
WScript.Echo "NLB node stoped"
ElseIf command = "Start" Then
WScript.Echo "Starting NLB node"
node.Start
WScript.Echo "NLB node started"
End If

oAPI.LogScriptEvent scriptName,eventID,eventSeverity,eventMessage

End If </Script></ScriptBody>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="Script"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.CommandOutput</OutputType>
<InputType>System!System.BaseData</InputType>
</WriteActionModuleType>