VMware Cloud Community
TomBrady5Rings
Contributor
Contributor

Kick-off powershell script that is present on a vm

Is there a way to kick off a powershell script that is present on a vm? I want the powershell script to run whether somebody is logged on or not. I understand I would have to provide credentials though. I would rather now have to use an intermediate pshost to run scripts against another server.

Reply
0 Kudos
4 Replies
improvingdaily
Enthusiast
Enthusiast

You can use the Run Program in guest workflow to do this.  You just have customize how it will launch your script.

Reply
0 Kudos
TomBrady5Rings
Contributor
Contributor

I have tried that. I chose powershell from the drop down list and typed in the path to the .ps1 file and ran it. The .ps1 file just creates a new-item in it's directory. It says the script was successful but I don't see the new file. If I run the script manually it creates the new file.

Reply
0 Kudos
TomBrady5Rings
Contributor
Contributor

I know this was a while ago but any update to my question? I created a .ps1 file on the server and I want to kick it off using the Guest Script Manager package but haven't been successful.

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee

Could you show what parameters do you use when running "run program in guest" workflow?

Something like the following should work:

  Interactive session -> Yes

  Program path -> c:\windows\system32\cmd.exe

  Arguments -> /k C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe c:\mycmd.ps1

(You may need to correct the file paths above to point to your .ps1 file and PowerShell executable.)

Also, check if UAC on the windows machine is not blocking the call.

Reply
0 Kudos