Saturday, July 29, 2023

RunAS


When open application in windows. Application will run under logged-in user context 

if want to run application under other than logged in user context from command prompt 

```sh
runas /user:"Domain\Users" "powershell"

```

To start the process, command, or app under other than logged in user context  from powershell

```sh

$cred = (Get-Credential)
Start-Process -FilePath "Ssms.exe" -Credential $cred

Start-Process -FilePath "powershell" -Credential $Cred

```


if you can get user credentials interactively through Windows Security prompt

```sh

# Run as Administrator

Start-Process -FilePath "powershell" -Verb RunAs

# Run as from another user

Start-Process -FilePath "ssms " -Verb RunAsUser

```

No comments:

Post a Comment