Reputation: 31
I want to create a shortcut to all domain users when it is clicked, e.g. notepad++ in admin mode popup without asking users to input password. i.e.notepad++ in admin mode
Same effect as I told user the admin username and password and ask them right click notepad++ icon then enter username and password.
I tried following but it is not working.
"runas /savecred /user:{hostname}\admin "C:\Program Files\Notepad++\notepad++.exe"
It actually only starts notepad++ in normal mode, even I entered admin password.
I tried autoit, but since even running the above not starting notepad++ in admin mode, so it is not working too. I think sanur also not working.
Start-Process 'C:\Program Files\Notepad++\notepad++.exe' -Verb runAs
Elevated window pop up and asking to enter admin username and password, the notepad++ started is in admin mode, but I don't want the pop up. And I couldn't find a way pass in the username and password.
$username = "admin" $password = "password" $credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force)) powershell Start-Process "C:\Program Files\Notepad++\notepad++.exe" -Credential ($credentials)
It actually only starts notepad++ in normal mode.
Upvotes: 0
Views: 4937
Reputation: 31
Thank you Theo for the comments.
The solution is
By right-click the normal shortcut --> Advanced --> tick Run as administrator --> OK
@echo off @start "" "C:\temp\Notepad++.lnk"
RunAs ( "{adminAccount}", "{hostname}", "{adminPassword}", 1, "C:\temp\notepad.bat")
The notepad++ in admin mode will be started without any elevated window pop up to ask you for admin credential.
Upvotes: 2