Script only work in runas consol and not with -verb RunAs option

Hello all,

I’m starting with powershell and i’m using an existing script in order to create a csv file with hash laptop info for Intune enrollment. (the script Get-WindowsAutoPilotInfo

I’ve juste done some modification in, in order to create a csv file named based on the serial number of the machine.

log as local administrator on my test machine, the script works well if i’m launching it in a PS consol runas admin (right click, run as…). If i’m launching it from a “classic” PS console, still launched by local administrator account, the script failed due to a lack of permissions on wmi request.

The mail goal is to launch automaticaly this script in MDT task and by a windows to go stick.

I’ve tried to launch it with the option -verb RunAs but still failed.

Someone has any idea ?

Tks in advance for your help.


Welcome to the forums.

If you have questions according a particular gallery script I’d recommend to contact the owners of the script via the link in the gallery
They will know their script best. :wink:


Tks for this advice, I’ve just sent him a message :slight_smile: