<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Calling a powershell script from SRM appliance in Site Recovery Manager Discussions</title>
    <link>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2843066#M13810</link>
    <description>&lt;P&gt;Before we run a disaster recovery test, there's a few house keeping things we need to do. There's a couple of production domain servers at the DR site that we need to clone. During the test we use the cloned versions of these DCs.&amp;nbsp; After the test, we delete the clones and power up the original DCs.&amp;nbsp; Why we do this is a long story.&lt;BR /&gt;&lt;BR /&gt;Years ago when SRM was still Windows based, we had a Powershell script on the SRM server that would do the clone.&amp;nbsp; We'd call it from SRM at the beginning of the recovery plan.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Now that SRM is an appliance, I manually run the script before I run the SRM recovery plan.&amp;nbsp; I would love to somehow incorporate this script at the beginning of the recovery plan.&lt;BR /&gt;&lt;BR /&gt;Also, is there a way to incorporate the calling of a powershell script during the cleanup process in SRM?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Apr 2021 13:02:15 GMT</pubDate>
    <dc:creator>Bruticusmaximus</dc:creator>
    <dc:date>2021-04-21T13:02:15Z</dc:date>
    <item>
      <title>Calling a powershell script from SRM appliance</title>
      <link>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2843066#M13810</link>
      <description>&lt;P&gt;Before we run a disaster recovery test, there's a few house keeping things we need to do. There's a couple of production domain servers at the DR site that we need to clone. During the test we use the cloned versions of these DCs.&amp;nbsp; After the test, we delete the clones and power up the original DCs.&amp;nbsp; Why we do this is a long story.&lt;BR /&gt;&lt;BR /&gt;Years ago when SRM was still Windows based, we had a Powershell script on the SRM server that would do the clone.&amp;nbsp; We'd call it from SRM at the beginning of the recovery plan.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Now that SRM is an appliance, I manually run the script before I run the SRM recovery plan.&amp;nbsp; I would love to somehow incorporate this script at the beginning of the recovery plan.&lt;BR /&gt;&lt;BR /&gt;Also, is there a way to incorporate the calling of a powershell script during the cleanup process in SRM?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 13:02:15 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2843066#M13810</guid>
      <dc:creator>Bruticusmaximus</dc:creator>
      <dc:date>2021-04-21T13:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a powershell script from SRM appliance</title>
      <link>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2843200#M13813</link>
      <description>&lt;P&gt;The ways to run powershell as part of a recovery plan are:&lt;BR /&gt;1. Call a script on the appliance (using bash, perl or python) that will call the powershell script on another VM. Ideally this other VM will always be running at the recovery site.&lt;/P&gt;&lt;P&gt;2. Run a script on a recovered VM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding running a script during cleanup, we haven't added this capability yet. It is something we're working on though.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 23:45:24 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2843200#M13813</guid>
      <dc:creator>vbrowncoat</dc:creator>
      <dc:date>2021-04-21T23:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a powershell script from SRM appliance</title>
      <link>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2865392#M13916</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have been looking to implement this, do you have example code how you managed to do this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Sep 2021 14:29:44 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2865392#M13916</guid>
      <dc:creator>Gr23</dc:creator>
      <dc:date>2021-09-05T14:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a powershell script from SRM appliance</title>
      <link>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2871765#M13938</link>
      <description>&lt;P&gt;i'm looking for it too, do you have some example of the script?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 15:38:00 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2871765#M13938</guid>
      <dc:creator>Hertzon</dc:creator>
      <dc:date>2021-10-13T15:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a powershell script from SRM appliance</title>
      <link>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2873818#M13943</link>
      <description>&lt;P&gt;I tried running a bash script on the SRM appliance that would call a Powershell script on a utility VM but, couldn't get it to go.&amp;nbsp; I was investing too much time into it and just gave up.&amp;nbsp; The simple solution is to just go back to the Windows version of SRM.&amp;nbsp; So our DR test is automated now except for one manual step.&amp;nbsp;It would have been cool to have it completely automated like it used to be before upgrading SRM.&lt;img class="lia-deferred-image lia-image-emoji" src="https://communities.vmware.com/html/@D5E6B168D16C1011E835DECBE0488360/emoticons/2639.png" alt=":frowning_face:" title=":frowning_face:" /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I submitted a feature request so, we'll see how that goes.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 14:25:47 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2873818#M13943</guid>
      <dc:creator>Bruticusmaximus</dc:creator>
      <dc:date>2021-10-22T14:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a powershell script from SRM appliance</title>
      <link>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2876666#M13951</link>
      <description>&lt;P&gt;Follow because I'm interested to this issue; I think it's impossible that the solution is to migrate to windows installation&lt;/P&gt;</description>
      <pubDate>Sat, 06 Nov 2021 11:11:22 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2876666#M13951</guid>
      <dc:creator>padulka</dc:creator>
      <dc:date>2021-11-06T11:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a powershell script from SRM appliance</title>
      <link>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2909806#M14025</link>
      <description>&lt;P&gt;I have an end user which just migrated to SRM appliance.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you happen to have an example script(bash/per/python) that running on the SRM appliance, which calling the VM that on the same network which the script resides on ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;They don't have the expert in house to rewrite such lengthy scripts in Perl/Python.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 17:30:34 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2909806#M14025</guid>
      <dc:creator>Leon_Eric</dc:creator>
      <dc:date>2022-05-18T17:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calling a powershell script from SRM appliance</title>
      <link>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2912127#M14026</link>
      <description>&lt;P&gt;This should work&lt;/P&gt;&lt;P&gt;PowerShell script that runs locally on windows SRM server version fails to run after photon OS version of SRM as it does not have access to the &lt;EM&gt;SRM Runtime environment variable.&amp;nbsp; SRM is now external .&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SRM Runtime variable&lt;/STRONG&gt; :&amp;nbsp;&lt;A href="https://docs.vmware.com/en/Site-Recovery-Manager/8.5/com.vmware.srm.admin.doc/GUID-2D288B46-27D1-41E9-81EE-618F1A6D5F98.html" target="_blank"&gt;https://docs.vmware.com/en/Site-Recovery-Manager/8.5/com.vmware.srm.admin.doc/GUID-2D288B46-27D1-41E9-81EE-618F1A6D5F98.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No need to change the entire PowerShell script, just a small piece of code injected on SRM appliance should work.&lt;/P&gt;&lt;P&gt;Step1 : Search your PowerShell script for anything starting with&amp;nbsp;$ENV.&amp;nbsp; . It is&amp;nbsp; a environment variable for example&amp;nbsp;$ENV.VMware_RecoveryName, $ENV.VMware_RecoveryMode, $ENV.VMware_VC_Host, $ENV.VMware_VC_Port.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step2 : SSH into the SRM appliance as 'admin' . upload the getEnv.py on /admin/home directory . If you want to use any other user please select the appropriate permission and location.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step3: go back to PowerShell script, you will need plink.exe to SSH&amp;nbsp; (download from&amp;nbsp;&lt;A href="https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html" target="_blank"&gt;https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html&lt;/A&gt;)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step4: To get the environment variable into your PowerShell script&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;$command = "python getEnv.py " + {prev SRM variable name}&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;$windows_var=&amp;nbsp;Write-Output 'y' | &amp;amp; $PLINKPATH -pw $SRMpassword $sRM_USERNAME@$SRM_hostname $command&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;example :&amp;nbsp; $command = "python getEnv.py " + "VMware_RecoveryName"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;getEnv,py returns the SRM runtime variable value in Uppercase or return 'NONE' . Have a&lt;EM&gt; if &lt;/EM&gt;condition to check the value is not 'NONE'&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 11:18:06 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Site-Recovery-Manager/Calling-a-powershell-script-from-SRM-appliance/m-p/2912127#M14026</guid>
      <dc:creator>Codiyapa</dc:creator>
      <dc:date>2022-06-01T11:18:06Z</dc:date>
    </item>
  </channel>
</rss>

