Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Running As Admin with Alternative Credentials

$
0
0

hello, i have a script which needs to be set to run as admin, i have the below script to do so.

Start-Process PowerShell -verb runas -ArgumentList '-noexit','-File','c:\pathtoscript.ps1'

However my question is if i am logged into my machine with an account that does not have the correct rights to execute the above script... is there a way i can call on a script using different credentials and running it as admin?

so if my normal username is abcd and my admin username is efgh, however can i run the script as efgh from my abcd account, also opening it elevated?

Many Thanks


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>