0

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.

  1. In cmd
"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.

  1. In powershell
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.

  1. In powershell
$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.

3
  • right-click the normal shortcut --> Advanced --> tick Run as administrator --> OK Commented Aug 24, 2021 at 12:34
  • I guess you'll need a GroupPolicy or system account to do want you want. Otherwise the UAC will always pop-up. Commented Aug 24, 2021 at 12:52
  • 3
    You really don't want the users to be able to work around the Windows security settings and UAC. What are you trying to accomplish by providing an application running in full admin mode? Commented Aug 24, 2021 at 14:46

1 Answer 1

2

Thank you Theo for the comments.

The solution is

  1. Create a shortcut and set it run as admin, eg, C:\temp\Notepad++.lnk

By right-click the normal shortcut --> Advanced --> tick Run as administrator --> OK

  1. Create a .bat to start the shortcut eg, C:\temp\notepad.bat (we need this step because runas cannot start .lnk file) The .bat file here also written to avoid a cmd window popup when run
    @echo off
    @start "" "C:\temp\Notepad++.lnk"

  1. Create autoit script to run the .bat by runas, eg. notepad.au3
    RunAs ( "{adminAccount}", "{hostname}", "{adminPassword}", 1, "C:\temp\notepad.bat")
  1. Use autoit to turn au3 script to exe

The notepad++ in admin mode will be started without any elevated window pop up to ask you for admin credential.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.