PowerCLI: Run commands in virtual-machine

/See edit below

You cannot. PowerCLI just lets you do things that you can do through the vSphere GUI, like add/remove drives, power on/off guests, migrate machines, etc. Read the docs, that's a really good thing to do before coming to a technical forum with a question. If you read over the list of cmdlets included in PowerCLI, you'd see this for yourself.

PowerCLI does not get you any hooks into the guest machines themselves. If you have left yourself no remote-management options because you disabled admin$ and WMI on the guests, you're stuck doing everything manually.

VMware != magic. You still have to administer the guest machines using the same methods you'd use on physical machines.

/edit - OK, good catch for finding invoke-vmscript. So, my answer above is not quite accurate.


Considering your remote administration options look to be used up, are these VMs in a domain? If so, you could run your script via Group Policy.


I've no idea about doing this through PowerCLI, but have you looked at PsExec? It can quite easily be used to run commands against a number of remote computers.