Sign in to follow this  
Followers 0
wdfboltonc

Writing to a file with elevated permissions

3 posts in this topic

Hi All,

I'm in the process of creating an AutoIT file to run periodically on a local machine and set the local administrator password to a random value. The important part of the script is that it will run in the user context but needs to output the new password to a locked down share that only IT support have access.

I'm having issues writing to a file with the standard $file = FileOpen('' & $NetworkLogPath & @ComputerName & '.log', 9) function. I have tried running it with a RunAs function with an account with write permissions to the folder but still unable to create and write to the file.

Any pointers would be welcomed.

Thanks

Craig

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

what error do you get?

p.s.
(not even to ask if your $NetworkLogPath variable ends with a slash "" of course)

Edited by PincoPanco

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Could always try to first DriveMapAdd the share, and then do the fileopen (that would get around the runas, since the rights are associated with the drive, and not the user running the script)...plus, DriveMapAdd returns a lot more @error data, for debugging.

I agree with PincoPanco, post the definition of those variables as well.

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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  
Followers 0