{"id":222,"date":"2014-11-25T12:22:06","date_gmt":"2014-11-25T19:22:06","guid":{"rendered":"http:\/\/blog.gptnet.net\/?p=222"},"modified":"2017-03-16T08:29:14","modified_gmt":"2017-03-16T15:29:14","slug":"vmware-site-recovery-manager-remote-powershell-script","status":"publish","type":"post","link":"http:\/\/blog.gptnet.net\/?p=222","title":{"rendered":"VMware Site Recovery Manager remote Powershell script"},"content":{"rendered":"<p>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&#8217;s quick and nice trick:<\/p>\n<pre class=\"brush:powershell\">c:\\windows\\system32\\windowspowershell\\v1.0\\powershell.exe -Command \"(Invoke-Command -ComputerName TargetPC -FilePath C:\\Script\\LocalScript.ps1)\"<\/pre>\n<p>TargetPC &#8211; name of the remote computer<br \/>\nC:\\Script\\LocalScript.ps1 &#8211; path of the script on local computer form which you&#8217;re running this command<\/p>\n<p>What is required in domain environment?<br \/>\n&#8211; on Remote server enable Windows Remote Management (winrm quickconfig)<br \/>\n&#8211; on Remote server make sure account (under which you&#8217;re executing Powershell command above) has correct permissions (i.e is a member local Administrator group)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"http:\/\/blog.gptnet.net\/?p=222\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44,84],"tags":[45,66,65,67],"class_list":["post-222","post","type-post","status-publish","format-standard","hentry","category-powershell","category-vmware","tag-powershell-2","tag-remote","tag-srm","tag-winrm"],"_links":{"self":[{"href":"http:\/\/blog.gptnet.net\/index.php?rest_route=\/wp\/v2\/posts\/222","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.gptnet.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.gptnet.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.gptnet.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.gptnet.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=222"}],"version-history":[{"count":1,"href":"http:\/\/blog.gptnet.net\/index.php?rest_route=\/wp\/v2\/posts\/222\/revisions"}],"predecessor-version":[{"id":223,"href":"http:\/\/blog.gptnet.net\/index.php?rest_route=\/wp\/v2\/posts\/222\/revisions\/223"}],"wp:attachment":[{"href":"http:\/\/blog.gptnet.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.gptnet.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=222"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.gptnet.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}