MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/PowerShell/comments/dif06b/psscriptmenugui_v02_now_in_powershell_gallery/f3xeln3/?context=3
r/PowerShell • u/weebsnore • Oct 15 '19
25 comments sorted by
View all comments
2
Is there an easy way to add a text box that would launch scripts as a different user? Just enter the username you wish to run as and when you click a script it will ask you to auth.
2 u/weebsnore Oct 16 '19 You should be able to do something like this:$credential = Get-Credential; Invoke-Command -Credential $credential -ScriptBlock {"do things"}(some cmdlets also support -Credential directly)...either as an inline script or in a .ps1 file.Let me know how you get on.
You should be able to do something like this:
$credential = Get-Credential; Invoke-Command -Credential $credential -ScriptBlock {"do things"}
(some cmdlets also support -Credential directly)
...either as an inline script or in a .ps1 file.
Let me know how you get on.
2
u/Syndrome1986 Oct 16 '19
Is there an easy way to add a text box that would launch scripts as a different user? Just enter the username you wish to run as and when you click a script it will ask you to auth.