I am trying to run a command as the Admin user with elevated permissions but PowerShell doesn't support this method.
Start-Process
-FilePath "powershell"
-ArgumentList "-Command New-RDSessionDeployment -ConnectionBroker $server -WebAccessServer $server -SessionHost $server"
-Verb RunAs
-Credential $creds
Start-Process : Parameter set cannot be resolved using the specified named parameters.
The combination of Verb
and Credential
are not supported.
NAME
Start-Process
SYNTAX
Start-Process [-FilePath] <string> [[-ArgumentList] <string[]>] [-Credential <pscredential>] [-WorkingDirectory <string>] [-LoadUserProfile] [-NoNewWindow] [-PassThru] [-RedirectStandardError <string>]
[-RedirectStandardInput <string>] [-RedirectStandardOutput <string>] [-WindowStyle {Normal | Hidden | Minimized | Maximized}] [-Wait] [-UseNewEnvironment] [<CommonParameters>]
Start-Process [-FilePath] <string> [[-ArgumentList] <string[]>] [-WorkingDirectory <string>] [-PassThru] [-Verb <string>] [-WindowStyle {Normal | Hidden | Minimized | Maximized}] [-Wait] [<CommonParameters>]
So how can I run an elevated powershell as another user??
UPDATE: I've come up with this nasty solution but unfortunately it prompts me to approve Elevated permissions which of course is because of UAT.
Start-Process
-Credential $creds
-FilePath "powershell"
-ArgumentList "Start-Process
-Verb RunAs
-FilePath powershell
-ArgumentList '-Command New-RDSessionDeployment -ConnectionBroker $server -WebAccessServer $server -SessionHost $server'"
Is there a way to run that above command as the Domain Admin for automated deployment??
Check this out: Running Powershell without UAC Prompt
Hope this helps.