Jump to content
Sign in to follow this  
scarboni

RunAs REG ADD

Recommended Posts

scarboni

Hello, I'm having a slight problem trying to change a regedit variable but can't get it to work for some reason. I need to run and change it as admin or it won't work in the environment we are using.

RunAs("username", "domain", "password", 0, @ComSpec & " /c " & 'REG ADD HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v SeparateProcess /t REG_DWORD /d 0x00000001 /f', "", @SW_HIDE)
Edited by scarboni

Share this post


Link to post
Share on other sites
BrewManNH

When you use RunAs, that part of the script will be run as a different user, so that the key you're trying to change will be changed for the user that you're running it as, not the current user.


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
wakillon

And like this ?

RunAs("username", "domain", "password", 0, @ComSpec & ' /c "REG ADD HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v SeparateProcess /t REG_DWORD /d 0x00000001 /f"', "", @SW_HIDE)

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
scarboni

Am I able to do this setting for all the users on the machine? by changing the location to HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced???

Edited by scarboni

Share this post


Link to post
Share on other sites
scarboni

That did change the value of the parameter but does it work? :S

Share this post


Link to post
Share on other sites
scarboni

This is one annoying nut to crack :S

I'm making a Admin tool for work and I got to the final stage where we cant run explorer.exe because windows needs to allow SeparateProcess in the regedit. It can be changed if the account you are using is Admin but the whole idea is to be able to run the program with a singel logon and than be able to use all the admin tools needed.

As I wrote in previouse post I'm trying to change the regedit state of SeparateProcess with RunAs, but as BrewManNH explained I will just do the changes to the RunAs account if I do it that way. So I went to the section with HKEY_USERS and changed the defult value of all users instead but I'm not sure if it works?

Is there anyone who know how to change the state of the current users account or to change it for all users as its really no harm done by changing that setting. And it has to be changed with domain or local Admin priveleges I think...

Share this post


Link to post
Share on other sites
AdamUL

Look at this it should do what you need.

I have used it many times.

Adam

Share this post


Link to post
Share on other sites
BrewManNH

I believe that the HKCU key is writable by any user logged in, you can check this by opening Regedit and checking the permissions on that key when you're logged in as a non-admin user.


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
scarboni

Thanks guys, ill do that :mellow: I hope it works...

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.