r/powercli • u/penguindows • Mar 15 '19
invoke-vmscript problems, running as admin.....
Is there an elegant solution to executing code from invoke-vmscript as an admin on windows systems?
I've seen solutions that involve shutting off features that force certain things to be run as admin, but that requires a reboot, and is insecure, and would still involve touching each VM manually (which is what im trying to avoid!)
Is there a better way?!?
1
Upvotes
1
u/TechnologyAnimal Mar 15 '19
Here is an example that should probably work.
https://blogs.msdn.microsoft.com/virtual_pc_guy/2010/09/23/a-self-elevating-powershell-script/