Jump to content

Run script as System or Administrator on non-access user


Recommended Posts

Hello AutoIt scriptwriters

I want to run script as System Account or Administrator Account on non-access users

 

I had set my server a password when non-access user wants to luanch or install exe files

 

But i want to make my script start automatically on all users even non-access users without asking password for luanching my AutoIt exe script at startup

Edited by Colduction
Link to comment
Share on other sites

Compile the script and run it through the task scheduler.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Do you have access to Group Policy? If you do, you can run it at log on through GP.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Run the script compiled during log in or boot up or how ever you want the script to run. You can use a batch file to run the executable from within GP.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

On 3/8/2019 at 3:39 PM, Colduction said:

Yeah, i know the password, but how to do that? 

Well I tried that at one time by building the admin password one character at a time using the CHR() function.

For a password of "Password1" the code I wrote initially was very rudimentary:

$theAdminPassword = Chr(80) & Chr(97) & Chr(115) & Chr(115) & Chr(119) & Chr(111) & Chr(114) & Chr(100) & Chr(49)

Doesn't do a lot to stop a clever and determined user, but does obfuscate it somewhat. Another way is to put the numbers into a text file and read them line by line to build the admin password. Then you can easily change admin passwords without rewriting code. I wrote something like this later as we changed our admin password:

$fHandle = FileOpen({some UNC path to a public file on the network}, 0)
$theAdminPassword = ""
While 1
  FileReadLine($fHandle, $theChar)
  If @error
    ExitLoop
  Endif
  $theAdminPassword = $theAdminPassword & Chr($theChar)
WEnd
FileClose($fHandle)

 

Who lied and told you life would EVER be fair?

Link to comment
Share on other sites

From what i know in my windows knowledge you can configure an executable to have administration rigth anyway without prompt. 

You just have to set it one time like that

I apologise for the "circles" 😂😂.

Rigth click on the executable and "properties"

Left click on "advanced"

image.thumb.png.e74d262d409553183b5a83d94e9de77b.png

This is working with all exe & shordcut

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

  • Developers
39 minutes ago, caramen said:

From what i know in my windows knowledge you can configure an executable to have administration rigth anyway without prompt. 

Nah... UAC will come up when enabled and rightly so or else we are back in the win95 days with all its security risks. ;) 

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Yeah anywhere the shield is seen you will have an UAC prompt(I have UAC disabled that's why i have no shield). But it's only when you remove the prompt i guess not when you run the item.

I dont know issue with that. If you can learn me that :) .

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

25 minutes ago, caramen said:

Yeah anywhere the shield is seen you will have an UAC prompt(I have UAC disabled that's why i have no shield). But it's only when you remove the prompt i guess not when you run the item.

I dont know issue with that. If you can learn me that :) .

maybe should use AsInvoker 🤕

Link to comment
Share on other sites

To not get the UAC prompt for Admins, without completely turning off UAC.  You would want to set the ConsentPromptBehaviorAdmin to 0, which is $UAC_ELEVATE_WITHOUT_PROMPTING.  I wrote a UDF for this.  This function call would need to be in a different script, run as admin, to set the setting.  After that, your scripts with #RequireAdmin or a compiled script with the manifest set to requireAdministrator will run without the UAC prompt.  As mentioned in the UDF: "Use this option only in the most constrained environments."

#RequireAdmin
#include <UAC.au3>

_UAC_SetConsentPromptBehaviorAdmin($UAC_ELEVATE_WITHOUT_PROMPTING)

 

Adam

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...