VMware Cloud Community
gil_t
Enthusiast
Enthusiast

Run invoke-VMScript as administrator

hi,

i was asked to write a script that gets a command and run it inside the a group of Vm's guest OS ( Windows).

i was able to write the script and if works fine,

my only problem is that some of my servers have some kind of hardening, and the commands must run as administrator in order to work.

is it possible to make it run as administrator?

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership

If you pass the guest credentials on the Invoke-VMScript cmdlet, the script will run under that account.

Afaik, if not provided, the cmdlet will use your credentials to run the script inside the guest.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
gil_t
Enthusiast
Enthusiast

hi,

i'm using the Invoke-VMScript cmdlet , and using a Administrator  account.

but still, some commands inside windows requires running as administrator ( running with an administrator account is not enough )

i'm talking about like things you need to right click and choose "run as administrator "

Reply
0 Kudos
LucD
Leadership
Leadership

Perhaps try running in elevated mode.

See  8.  Re: Invoke-VMScript to run ps commands as an administrator


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos