Enabling PowerShell Functions with SRM - DR of the Cloud
Enabling PowerShell Functions with SRM - DR of the Cloud
When calling PowerShell functions as part of a Site Recovery Manager (SRM) v5.1 recovery plan, you need to perform some additional configurations within PowerShell.
This can be achieved using the following procedures.
Step 1 - Set the execution level
- Launch the 32-bit version of PowerShell.
- Set the execution policy to RemoteSigned.
1Set-ExecutionPolicy RemoteSigned
Step 2 - Create and configure a PowerShell profile
- Verify if a profile already exists for the user. (assuming that one does not exist go to step 2)
1Test-Path $profile
- Force the creation of a new profile file.
1New-Item $profile -type file -force
- Open the new file in a Notepad session.
1Notepad $profile
- Enter the following syntax into the file, then save and close:
1Import-Module vCloudDR
2Add-PSSnapin -name VMware.VimAutomation.Core
Next time you start a new PowerShell session, it will load in our custom functions from the vCloudDR module and add in the VMware core cmdlets.
Step 3 - Install the custom modules for PowerShell to call
- Locate the folder path 'C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Modules'
- Create a new folder called 'vCloudDR'.
NOTE
This folder name must match the name used for the Import-Module command used in the profile in Step 2.
- Copy your custom module file into the newly created folder
- To test that the module has been loaded correctly, restart PowerShell and verify your custom module is listed by running the following command:
1Get-Module -ListAvailable