Microsoft.SystemCenter.VirtualMachineManager.2012.ReassociateComputerTask (WriteActionModuleType)
Element properties:
Member Modules:
Source Code:
<WriteActionModuleType ID="Microsoft.SystemCenter.VirtualMachineManager.2012.ReassociateComputerTask" Accessibility="Internal">
<Configuration>
<IncludeSchemaTypes>
<SchemaType>Windows!Microsoft.Windows.PowerShellSchema</SchemaType>
</IncludeSchemaTypes>
<xsd:element name="ComputerName" type="xsd:string"/>
</Configuration>
<ModuleImplementation>
<Composite>
<MemberModules>
<WriteAction ID="reassociateComputer" TypeID="Windows!Microsoft.Windows.PowerShellWriteAction">
<ScriptName>reassociateComputerScript</ScriptName>
<ScriptBody><Script>
$evt = New-Object System.Diagnostics.Eventlog("VM Manager");
$evt.Source = "Microsoft.SystemCenter.VirtualMachineManager.2012.Monitoring";
$errevent = [System.Diagnostics.EventLogEntryType]::Error;
$error.Clear();
$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)
{
$evt.WriteEntry($error, $errevent , 25940);
return;
}
Import-Module ($modulePath.InstallPath + "bin\psModules\virtualmachinemanagercore\virtualmachinemanagercore.psd1");
if ($error.Count -ne 0)
{
$evt.WriteEntry($error, $errevent , 25941);
return;
}
}
$server = Get-SCVMMServer localhost;
if ($server -eq $())
{
$message = "VMM Server is not available"
$evt.WriteEntry($message, $errevent , 25941);
return;
}
$computer = Get-SCVMMManagedComputer -ComputerName $Config/ComputerName$;
if ($computer -ne $())
{
Register-SCVMMManagedComputer -VMMManagedComputer $computer;
}
</Script></ScriptBody>
<Parameters/>
<TimeoutSeconds>30</TimeoutSeconds>
<StrictErrorHandling>true</StrictErrorHandling>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="reassociateComputer"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>Windows!Microsoft.Windows.SerializedObjectData</OutputType>
<InputType>System!System.BaseData</InputType>
</WriteActionModuleType>