Jump to content

Run as an administrator


Recommended Posts

  • Developers

Not sure what you are asking. 

Yes you can enforce a script to be ran as Administrator with #RequireAdmin, but that will trigger UAC in case it isn't running at that level yet, unless UAC is disabled.

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

 

Yes Jos I was wondering if I could run the program with #RequireAdmin --> as a  normal user.

So if I understood well using  #RequireAdmin in the script will give to the executable file (after compiled) the elevated rights of the SYSTEM account?

In this scenario if the UAC is disabled any user can install the program, isn't it?

 

Thanks

Link to comment
Share on other sites

If the UAC is disabled, the #RequireAdmin  directive is useless. A standard user cannot install a program directly (a program witch needs admin rights). It's possible to use the Run as different user option with an admin user (RunAs function).

 

 



 

 

 

Link to comment
Share on other sites

You want to RUN a program with admin rights , without having admin rights :) Or runas admin rights. So i guess you want to 'attach' to the system account for some reason. This is suspicious behavior. Why would you need that ?

Link to comment
Share on other sites

Thank you all.

The reason I need this option is beacuse I am managing a PCs LAB used for students to practice various projects and computing studies. If for example the students need to pratice with network adapter changing the IP address from automatic to static they need  Admin right to do it. This seems the only way for them to do some actions without having admin right.

In this scenario could I use RunAs to execute an .exe or script from a standard user? 

So if i use RunAS as below I should solve my problem?

RunAs(LocalAdmin, @ComputerName, Passw0rd,1, ' C:\folder\program.exe')

Thanks

 

 

 

 

Edited by Epulone
Link to comment
Share on other sites

I suggested this options to the lecturer using the "bridge" option in VM workstation but I was told it was not functional for the module he want to teach one because VM is not part of the lessions second because he wish the student act directly on the machines as for example with a cossover cable to joint two PCs.

Link to comment
Share on other sites

You're just going about this totally wrong, these computers shouldn't be on the schools network they should be isolated to their own network, then give the students admin access to the computers. This way if they try to do something malicious they won't affect the school's network.

Doing it any other way is just going to be a huge disaster waiting to happen.

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

  • 1 month later...
Quote

If the UAC is disabled, the #RequireAdmin  directive is useless.

I have UAC disabled and I just fixed a script that would not work by adding #RequireAdmin. So it's worth a try.

Edited by shmuelw1
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...