Hi,
In a recovery plan, I need to execute a script in the SRM server in the recovery site in a Recovery plan to execute a set of powershell scripts in the vcentre server in the recovery site.
I have decided to run a batch file in the SRM server to execute the set of scipts in the vcentre server.
I am not sure about the commands to be used in this batch file to run the scripts in the vcentre server, can someone help me in this.
No problem.
The command will run whatever script you want:
psexec \\vcenter_name_or_ip -u user_account -p password powershell.exe &'c:\my scripts\test.ps1'
What appears in bold is a path to script on vCenter server.
Michael.
Hi if got the script can you please share with me
-------------------------
please award points if you see fit.Thanks
Hi,
Following article explains well what you need:
Michael.
Hi Michael,
The article given by you talks about opening the console in SRM server and running a powershell script.
I am asking for a command which redirects the above powershell script to trigger another powershell script in vcenter server.
Thanks
Malar
Sure Satya, If I get the command for thsi I will let you know
Thanks
Malar
The article explains how to run powershell script as part of recovery plan.
As an example, in the article that powershell script edits VMs. In your case powershell script will run psexec to run script on remote server, something like:
psexec \\vcenter_name_or_ip -u user_account -p password powershell.exe ....
Michael.
Hi MIchael,
Thanks for the reply.
I just have one doubt it might look silly though, the command which you have given last will it run another powershell script or edit the virtual machine in vcenter.
Thanks
Malar
No problem.
The command will run whatever script you want:
psexec \\vcenter_name_or_ip -u user_account -p password powershell.exe &'c:\my scripts\test.ps1'
What appears in bold is a path to script on vCenter server.
Michael.
Thanks a lot for your help.
I tried dpoing the way you mentioned but the recovery plan returns an error message "Warning - The command 'c:\windows\system32\cmd.exe' returned a non-zero value: 1." When I saw the log in SRM it states it is not able to psexec' is not recognized as an internal or external command, operable program or batch file."
Any help in this regard please.
Thanks
Malar
psexec is not a Windows command. It is a utility you need to download and put on SRM server.
Yes Michael, I downloaded it and placed it in c:\ of the SRM Server. The error which I mentioned above is after I did this.
Thanks
Malar
You need to provide a full path to exe file in SRM command.
When I try running the same command in SRM it runs properly but then when I run it in SRM recovery plan it keeps giving this error message.
Hi Michael,
Thanks lot for your help.
I figured where I went wrong, I went wrong in teh authentication part and the SRM service awas set in delayed start.
After I rectified all these the issue got resolved.
Thanks
Malar