OpsMgr.2012.Self.Maintenance.Get.DataWarehouse.Retention.Write.Action (WriteActionModuleType)

Element properties:

TypeWriteActionModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
InputTypeSystem.BaseData

Member Modules:

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

Overrideable Parameters:

IDParameterTypeSelector
TimeoutSecondsint$Config/TimeoutSeconds$

Source Code:

<WriteActionModuleType ID="OpsMgr.2012.Self.Maintenance.Get.DataWarehouse.Retention.Write.Action" Accessibility="Internal" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="TimeoutSeconds" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<WriteAction ID="PSScript" TypeID="Windows!Microsoft.Windows.PowerShellWriteAction">
<ScriptName>GetDWRetention.ps1</ScriptName>
<ScriptBody><Script>
#===========================================================================================
# AUTHOR: Tao Yang
# Script Name: GetDWRetention.ps1
# DATE: 04/06/2013
# Version: 1.0
# COMMENT: - Script to check OpsMgr Data Warehouse DB retention setting
#===========================================================================================
Param (
[Parameter(Mandatory=$true)]
[string]$dwdatarpPath)

#Read Default SDK service computer name from the management server
$objReg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $ManagementServer)
$objRegKey= $objReg.OpenSubKey("SOFTWARE\\Microsoft\\Microsoft Operations Manager\\3.0\\Machine Settings" )
$MachineRegKeyPath = "HKLM:\software\Microsoft\Microsoft Operations Manager\3.0\Machine Settings"
$SDKServiceMachine = $objRegKey.GetValue("DefaultSDKServiceMachine")

If (!$SDKServiceMachine)
{
#can't detect the default SDK service machine, cannot continue...
Write-Host "Cannot detect the default SDK service machine. This computer may not be an OpsMgr management server. Scriptcannot continue." -ForegroundColor Red
Exit
}

#Read SCOM DW DB location from management server registry
$objRegKey= $objReg.OpenSubKey("SOFTWARE\\Microsoft\\Microsoft Operations Manager\\3.0\\Setup" )
$OpsDWDBServerName = $objRegKey.GetValue("DataWarehouseDBServerName")
$OpsDWDBName = $objRegKey.GetValue("DataWarehouseDBName")

#generate command
$cmd = "'$dwdatarpPath' -s $OpsDWDBServerName -d $OpsDWDBName"
Write-Host "DW Database Server: $OpsDWDBServerName" -ForegroundColor Yellow
Write-Host "DW Database Name: $OpsDWDBName" -ForegroundColor Yellow
Write-Host "dwdatarp.exe location: $dwdatarpPath" -ForegroundColor Yellow
Write-Host ""
Write-Host "DW Retention Setting:" -ForegroundColor Yellow
Invoke-Expression "cmd /c $cmd"
</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>dwdatarpPath</Name>
<Value>$FileResource[Name="Dwdatarp.Binary"]/Path$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="PSScript"/>
</Composition>
</Composite>
</ModuleImplementation>
<InputType>System!System.BaseData</InputType>
</WriteActionModuleType>