Users Guide

: 如果在初始启动后对导出的受保护机器运行一次 PostExportScript则无输入参数。常规受保护机器应将此脚本作为
PostExportScript.ps1 包含在 PowerShell 脚本文件夹中。
示例 PostExportScript
# receiving parameter from export job
param([object]$ExportJobRequest)
# building path to Core's Common.Contracts.dll and loading this assembly
$regLM = [Microsoft.Win32.Registry]::LocalMachine
$regLM = $regLM.OpenSubKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\AppRecovery
Core 5')
$regVal = $regLM.GetValue('InstallLocation')
$regVal = $regVal + 'CoreService\Common.Contracts.dll'
[System.Reflection.Assembly]::LoadFrom($regVal) | out-null
$regVal2 = $regLM.GetValue('InstallLocation')
$regVal2 = $regVal2 + 'CoreService\Common.Contracts.dll'
# Converting input parameter into specific object
$ExportJobRequestObject = $ExportJobRequest -as
[Replay.Core.Contracts.Export.ExportJobRequest]
# Working with input object. All echo's are logged
if($ExportJobRequestObject -eq $null) {
echo 'ExportJobRequestObject parameter is null'
}
else {
echo 'VolumeImageIds:' $ExportJobRequestObject.VolumeImageIds
echo 'RamInMegabytes:' $ExportJobRequestObject.RamInMegabytes
}
PreNightlyJobScript.ps1
PreNightlyJobScript 在任何每夜作业前于 Core 端运行。此脚本具有 $JobClassName 参数有助于分别处理那些子作业。
示例 PreNightlyJobScript
# receiving parameters from Nightlyjob
param([System.String]$JobClassMethod , [object]$NightlyAttachabilityJobRequest, [object]
$RollupJobRequest, [object]$Agents, [object]$ChecksumCheckJobRequest, [object]
$TransferJobRequest, [int]$LatestEpochSeenByCore)
# building path to Core's Common.Contracts.dll and loading this assembly
$regLM = [Microsoft.Win32.Registry]::LocalMachine
$regLM = $regLM.OpenSubKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\AppRecovery
Core 5')
$regVal = $regLM.GetValue('InstallLocation')
$regVal = $regVal + 'CoreService\Common.Contracts.dll'
[System.Reflection.Assembly]::LoadFrom($regVal) | out-null
# Nightlyjob has four child jobs: NightlyAttachability Job, Rollup Job, Checksum Check Job
and Log Truncation Job. All of them are triggering the script, and $JobClassMethod (contain
job name that calls the script) helps to handle those child jobs separately
switch ($JobClassMethod) {
# working with NightlyAttachability Job
NightlyAttachabilityJob {
$NightlyAttachabilityJobRequestObject = $NightlyAttachabilityJobRequest -as
[Replay.Core.Contracts.Sql.NightlyAttachabilityJobRequest];
echo 'Nightly Attachability job results:';
if($NightlyAttachabilityJobRequestObject -eq $null) {
echo 'NightlyAttachabilityJobRequestObject parameter is null';
}
else {
echo 'AgentIds:' $NightlyAttachabilityJobRequestObject.AgentIds;
echo 'IsNightlyJob:' $NightlyAttachabilityJobRequestObject.IsNightlyJob;
}
break;
}
# working with Rollup Job
RollupJob {
404 使用脚本扩展 Rapid Recovery 作业