DataONTAP.Cluster.ManagementServer.RemoveResourcePoolMember.WriteActionModuleType (WriteActionModuleType)

Element properties:

TypeWriteActionModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
InputTypeSystem.BaseData

Member Modules:

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

Overrideable Parameters:

IDParameterTypeSelector
TimeoutSecondsint$Config/TimeoutSeconds$
ManagementServerNamestring$Config/ManagementServerName$

Source Code:

<WriteActionModuleType ID="DataONTAP.Cluster.ManagementServer.RemoveResourcePoolMember.WriteActionModuleType" Accessibility="Internal" Batching="false">
<Configuration>
<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="ManagementServerName" type="xsd:string"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
<OverrideableParameter ID="ManagementServerName" Selector="$Config/ManagementServerName$" ParameterType="string"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<WriteAction ID="RunRemoteUninstallManagementServerPowershellScript" TypeID="Windows!Microsoft.Windows.PowerShellWriteAction">
<!-- ScriptName specifies the name of the script. -->
<ScriptName>RemoveManagementServer.ps1</ScriptName>
<!-- ScriptBody is the text of the script. -->
<ScriptBody><Script>##############################################################################
# Copyright (c) 2013 NetApp.
#
# RemoveManagementServer.ps1
#
# This script calls Management Server c# code to remote uninstall OCPM on
# management server.
##############################################################################

param($managementServerName)

import-module operationsmanager

$api = new-object -comObject 'MOM.ScriptAPI'

# Construct the event message with management server name
$eventMessage = "Uninstalling OCPM on Management server {0}."

# Log event with number 6000
$api.LogScriptEvent("RemoveManagementServer.ps1", 6000, 0, $eventMessage -f $managementServerName)

try
{
if (Test-Path -path HKLM:\SOFTWARE\NetApp\OnCommand\MS_Plugin)
{
# Check for the registry key value of the install location for NetApp
$key = get-itemproperty "HKLM:\SOFTWARE\NetApp\OnCommand\MS_Plugin"
}
elseif (Test-Path -path HKLM:\SOFTWARE\IBM\OnCommand\MS_Plugin)
{
# Check for IBM registry key since can't find NetApp
$key= get-itemproperty "HKLM:\SOFTWARE\IBM\OnCommand\MS_Plugin"
}
else
{
$errorMessage = "Error: OnCommand Plug-in for Microsoft is not installed on local machine."
$api.LogScriptEvent("Monitoring.ps1", 6002, 1, $errorMessage)
throw $errorMessage
}

$value = $key.InstallPath

# Load the OC.Cluster.OM.Server assembly from the install location
$assembly = [Reflection.Assembly]::LoadFrom($value + 'OC.Cluster.OM.Management.Tasks.dll')

# Remote install on the server
# Create a new Discovery object
$managementServer = New-Object OC.Cluster.OM.Management.Tasks.RemoteInstall

# Call remote install method
$managementServer.PerformRemoteUninstall($managementServerName)

$successMessage = "Uninstalling OCPM on Management server {0} succeeded."
$api.LogScriptEvent("RemoveManagementServer.ps1", 6001, 0, $successMessage -f $managementServerName)
$successMessage -f $managementServerName
}
catch
{
$api.LogScriptEvent("RemoveManagementServer.ps1", 6002, 1, "Remote uninstall OCPM failed. " + $Error)
throw $Error
}</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>managementServerName</Name>
<Value>$Config/ManagementServerName$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<StrictErrorHandling>true</StrictErrorHandling>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="RunRemoteUninstallManagementServerPowershellScript"/>
</Composition>
</Composite>
</ModuleImplementation>
<InputType>System!System.BaseData</InputType>
</WriteActionModuleType>