Jump to content

RunAsSet w/ RegWrite and ProcessClose


Recommended Posts

Sorry for the 2nd post today....

I need to write to the registry as a non admin and also close a process. RunAsSet doesn't work with these commands as it only works with Run and RunWait commands. I can do this via cmd line Run's but just wanted to see if there's a prettier way around this. thanks ahead of time!

-redfive

Link to comment
Share on other sites

I'll try a shell execute but I'm also having problems using _FileWriteToLog while writing as a non admin to an external USB Drive. I am guessing it has to do with NTFS writes/policy on this build but I'd like to get around that too.....this is the last piece of a huge puzzle and fixing it will be awesome!! thanks for your help today Volly, you rule.

Link to comment
Share on other sites

  • Developers

Restart the script by doing a RunAsSet() and the Run(@ScriptFullPath)..

Several examples are posted ....

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

  • Developers

$username="Administrator"           ; local admin account name
$Password="psw"                     ; local admin account psw
$run = 0                            ; run indicator 
; retrieve the cycle from commandline
If $CmdLine[0] = 1 then $run = $CmdLine[1]
If $run = 0 then
   RunAsSet ($Username, @Computername, $Password)
   ; start the script program (itself) again but now in Adminmode...so all done tasks will run in Adminmode
   Run('"' & @ScriptFullPath & '" " 1"' ) 
   if @error = 1 then msgbox(48,"Error","cannot start ... wrong admin userid or psw")      
   exit 
EndIf

:)

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

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