Hi,
I am unable to get the Recovery Plan Name from below as it shows MoRef. how can I get name from MoRef ?
Please help!!
connect-viserver "MyvCenter"
$SrmConnection = Connect-SrmServer
$SrmApi = $SrmConnection.ExtensionData
$recoveryPlans = $SrmApi.Recovery.ListPlans()
$recoveryPlans
MoRef
-----
SrmRecoveryPlan-srm-aa22138f-7375-49c7-be70-bc6940ab29d8
SrmRecoveryPlan-srm-6e954852-53ca-46c9-bb3c-d521a72717af
SrmRecoveryPlan-srm-62f9a62f-056b-437d-aca1-434c488d5445
Try with
$SrmApi.Recovery.ListPlans() |
Foreach-Object -Process {
$_.GetInfo() | Select Name
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try with
$SrmApi.Recovery.ListPlans() |
Foreach-Object -Process {
$_.GetInfo() | Select Name
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can use Get-SrmRecoveryPlan
Please refer the following web site to install srm-powercli-cmdlets
https://developer.vmware.com/samples/2512/srm-powercli-cmdlets
That worked perfectly. Thank you
Thank you for your reply. But in the below mentioned link, it used Power CLI 6.5, where I again I need to install another version of PowerCLI along with PowerCLI 12.x. I dont think, we can have multiple version of PowerCLI installed ?
I would like to use the existing cmdlets or API, which are available in PowerCLI 12.x
I have used this Function for a couple of years on different PowerCLI release, I don't think you need to install another version of PowerCLI , simply install the function will do the trick.
This function required with PowerCLI 6.5.1 or later. PowerShell 5.0 and above is required. I believe all Windows 10 PC or Windows 2019 server can easily meet this requirement.
Got your message, in order to change the setting the priority (Highest, High, Normal Low and Lowest) for VMs in a particular Recovery Group in SRM, you can try following approach.(As the current company I am working do not use SRM, I can't do a test)
Download the custom SRM functions https://raw.githubusercontent.com/benmeadowcroft/SRM-Cmdlets/99d036842c05738756afb26c11bc7ef5a4a524f...
# Load the custom functions
. ./SrmFunctions.ps1
. ./Examples/ReportConfiguration.ps1
# Connect to protected site VC & SRM
$creds = Get-Credential
$vca = Connect-VIServer vc-w12-01a.corp.local -Credential $creds
$srma = Connect-SrmServer -Server $vca -Credential $creds -RemoteCredential $creds
# Output Current SRM Configuration Report
Get-SrmConfigReport
# get recovery plan
$rp = Get-RecoveryPlan "Anaheim"
# get protected VM
$pvm = $rp | Get-ProtectedVM | Select -First 1
# view recovery settings
$rs = $pvm | Get-RecoverySettings -RecoveryPlan $rp
# update recovery priority
$rs.RecoveryPriority = "highest"
# create new command callout
$srmCmd = New-SrmCommand -Command '/bin/bash /root/failover.sh' -Description 'Run standard linux failover script' -RunInRecoveredVm
# add command as post recovery command callout
Add-PostRecoverySrmCommand -RecoverySettings $rs -SrmCommand $srmCmd
# update the recovery settings on the SRM server
Set-RecoverySettings -ProtectedVm $pvm -RecoveryPlan $rp -RecoverySettings $rs
# validate recovery settings (view in report)
Get-SrmConfigReportProtectedVm
Hi,
I tried importing the modules as specifed but getting the error
Unable to find type [VMware.VimAutomation.ViCore.Types.V1.Srm.SrmServer].
At D:\SRM\Set_Recovery_Priority.ps1:16 char:9
+ [VMware.VimAutomation.ViCore.Types.V1.Srm.SrmServer] $SrmServ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (VMware.VimAutom...1.Srm.SrmServer:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
Hi there,
Have you downloaded both SrmFunctions.ps1 and ReportConfiguration.ps1? Please download both and try to Dot-sourcing again. I tested on my laptop, done successfully.
import-module "C:\docs\Scripts\Function\SrmFunctions.ps1" -verbose -Force
import-module "C:\docs\Scripts\Function\ReportConfiguration.ps1" -verbose -Force
VERBOSE: Loading module from path 'C:\docs\Scripts\Function\SrmFunctions.ps1'.
VERBOSE: Dot-sourcing the script file 'C:\docs\Scripts\Function\SrmFunctions.ps1'.
VERBOSE: Loading module from path 'C:\docs\Scripts\Function\ReportConfiguration.ps1'.
VERBOSE: Dot-sourcing the script file 'C:\docs\Scripts\Function\ReportConfiguration.ps1'.
Hi,
I tried as below, even after importing, it is shows error
Try the following, replace "Your vCenter server" with yours
# Connect to protected site VC & SRM
$creds = Get-Credential
$vca = Connect-VIServer "Your vCenter server" -Credential $creds
$srma = Connect-SrmServer -Server $vca -Credential $creds -RemoteCredential $creds
# Output Current SRM Configuration Report
Get-SrmConfigReport
Hi,
Still the same error, May I know, what version of powercli you are using ?
Hi
I am using PowerCLI 12.7.0 build 20091289 over Windows PowerShell 5.1
BTW, since my current employer does not use SRM anymore, I can't tested it.
PowerCLI Version
----------------
VMware.PowerCLI 12.7.0 build 20091289
---------------
Component Versions
---------------
VMware Common PowerCLI Component 12.7 build 20067789
VMware Cis Core PowerCLI Component PowerCLI Component 12.6 build 19601368
VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 12.7 build 20091293
$PSversiontable
Name Value
---- -----
PSVersion 5.1.19041.3031
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.3031
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
