The following sample scripts are provided to assist administrative users in executing PowerShell scripts.
The following sample scripts are provided to assist administrative users in executing PowerShell scripts.
The PreTransferScript is run on the protected machine before transferring a snapshot.
# receiving parameter from transfer job param([object]$TransferPrescriptParameter) # building path to Agent's Common.Contracts.dll and loading this assembly $regLM = [Microsoft.Win32.Registry]::LocalMachine $regLM = $regLM.OpenSubKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\AppRecovery Agent 5') $regVal = $regLM.GetValue('InstallLocation') $regVal = $regVal + 'Common.Contracts.dll' [System.Reflection.Assembly]::LoadFrom($regVal) | out-null # Converting input parameter into specific object $TransferPrescriptParameterObject = $TransferPrescriptParameter -as [Replay.Common.Contracts.PowerShellExecution.TransferPrescriptParameter]; # Working with input object. All echo's are logged if($TransferPrescriptParameterObject -eq $null) { echo 'TransferPrescriptParameterObject parameter is null' } else { echo 'TransferConfiguration:'$TransferPrescriptParameterObject.TransferConfiguration echo 'StorageConfiguration:' $TransferPrescriptParameterObject.StorageConfiguration }
The PostTransferScript is run on the protected machine after transferring a snapshot.
# receiving parameter from transfer job param([object] $TransferPostscriptParameter) # building path to Agent's Common.Contracts.dll and loading this assembly $regLM = [Microsoft.Win32.Registry]::LocalMachine $regLM = $regLM.OpenSubKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\AppRecovery Agent 5') $regVal = $regLM.GetValue('InstallLocation') $regVal = $regVal + 'Common.Contracts.dll' [System.Reflection.Assembly]::LoadFrom($regVal) | out-null # Converting input parameter into specific object $TransferPostscriptParameterObject = $TransferPostscriptParameter -as [Replay.Common.Contracts.PowerShellExecution.TransferPostscriptParameter]; # Working with input object. All echo's are logged if($TransferPostscriptParameterObject -eq $null) { echo 'TransferPostscriptParameterObject parameter is null' } else { echo 'VolumeNames:' $TransferPostscriptParameterObject.VolumeNames echo 'ShadowCopyType:' $TransferPostscriptParameterObject.ShadowCopyType echo 'ForceBaseImage:' $TransferPostscriptParameterObject.ForceBaseImage echo 'IsLogTruncation:' $TransferPostscriptParameterObject.IsLogTruncation }
The PreExportScript is run on the Core before any export job.
# 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 # 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 'Location:' $ExportJobRequestObject.Location echo 'Priority:' $ExportJobRequestObject.Priority }
© ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center