VMware Site Recovery Manager remote Powershell script

You have a PowerShell script designed to run locally, but you need to execute it on remote computer via another product such as VMware Site Recovery Manager . You need to keep all your scripts in central repository but you need to execute them on multiple servers. Does this sound familiar? Here’s quick and nice trick:

c:\windows\system32\windowspowershell\v1.0\powershell.exe -Command "(Invoke-Command -ComputerName TargetPC -FilePath C:\Script\LocalScript.ps1)"

TargetPC – name of the remote computer
C:\Script\LocalScript.ps1 – path of the script on local computer form which you’re running this command

What is required in domain environment?
– on Remote server enable Windows Remote Management (winrm quickconfig)
– on Remote server make sure account (under which you’re executing Powershell command above) has correct permissions (i.e is a member local Administrator group)

This entry was posted in Powershell, VMware and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *