Jump to content
Sign in to follow this  
redfive19

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

Share this post


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

Share this post


Link to post
Share on other sites

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

Several examples are posted ....

Share this post


Link to post
Share on other sites

Wow this sounds exactly like what I need however I'm a bit confused as to how to do this or what to even search on. Thanks JdeB!

- redfive

Share this post


Link to post
Share on other sites

$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

:)

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  

×
×
  • Create New...