Microsoft.SystemCenter.VirtualMachineManager.BalanceClusterTask (WriteActionModuleType)
Element properties:
Member Modules:
Source Code:
<WriteActionModuleType ID="Microsoft.SystemCenter.VirtualMachineManager.BalanceClusterTask" Accessibility="Internal">
<Configuration>
<IncludeSchemaTypes>
<SchemaType>Windows!Microsoft.Windows.PowerShellSchema</SchemaType>
</IncludeSchemaTypes>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ClusterName" type="xsd:string"/>
</Configuration>
<ModuleImplementation>
<Composite>
<MemberModules>
<WriteAction ID="balanceCluster" TypeID="Windows!Microsoft.Windows.PowerShellWriteAction">
<ScriptName>balanceClusterScript</ScriptName>
<ScriptBody><Script>$module = get-module -Name "virtualmachinemanager";
if ($module -eq $())
{
$modulePath = get-itemproperty -path "hklm:\software\microsoft\microsoft system center virtual machine manager server\setup";
if ($error.Count -ne 0)
{
New-WinEvent -ProviderName "Microsoft-VirtualMachineManager-Server" -Id 4005
return;
}
Import-Module ($modulePath.InstallPath + "bin\psModules\virtualmachinemanagercore\virtualmachinemanagercore.psd1");
if ($error.Count -ne 0)
{
New-WinEvent -ProviderName "Microsoft-VirtualMachineManager-Server" -Id 4006
return;
}
}
$server = Get-SCVMMServer localhost;
if ($server -eq $())
{
New-WinEvent -ProviderName "Microsoft-VirtualMachineManager-Server" -Id 4007
return;
}
Try
{
$cluster = get-scvmhostcluster -Name $Config/ClusterName$;
if ($cluster -ne $())
{
Start-SCDynamicOptimization -VMHostCluster $cluster -VMMServer $server
}
}
Finally
{
if ($server -ne $null)
{
$server.Disconnect();
}
}</Script></ScriptBody>
<Parameters/>
<TimeoutSeconds>30</TimeoutSeconds>
<StrictErrorHandling>true</StrictErrorHandling>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="balanceCluster"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>Windows!Microsoft.Windows.SerializedObjectData</OutputType>
<InputType>System!System.BaseData</InputType>
</WriteActionModuleType>