Jump to content
Epulone

Run as an administrator

Recommended Posts

Epulone

There is a way to run a compiled script as an administrator in a user account?

Thanks

Share this post


Link to post
Share on other sites
Jos

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

  • Like 1

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Epulone

 

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

Share this post


Link to post
Share on other sites
jguinch

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).

 

 



 

 

 

Share this post


Link to post
Share on other sites
Juvigy

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 ?

Share this post


Link to post
Share on other sites
Earthshine

well you can run it like that, and it will prompt you for admin access, like you know, a password


My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
Epulone

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

Share this post


Link to post
Share on other sites
Earthshine

They should be running in VM


My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
Epulone

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.

Share this post


Link to post
Share on other sites
Juvigy
On 1/13/2018 at 4:07 PM, Epulone said:

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

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

Yes.

Share this post


Link to post
Share on other sites
BrewManNH

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.

  • Like 2

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

Share this post


Link to post
Share on other sites
Earthshine

yep. grade A disaster waiting to happen. could not be more wrong of a solution! good luck. Set up VMWare VMs for them to play in on their own network

Edited by Earthshine
  • Like 1

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
shmuelw1
Posted (edited)
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

Share this post


Link to post
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

×