Sign in to follow this  
Followers 0
mattress

RunAsSet with Variables?

2 posts in this topic

I'm having trouble getting RunAsSet working with variables as the username and password, is it possible to put a variable for the username and password?

$username = InputBox("Login", "Enter YOUR Username.", "", "", -1, -1, 0, 0)

$password = InputBox("Password", "Enter YOUR password.", "", "*", -1, -1, 0, 0)

$pc = EnvGet("computername")

$file = FileOpen("c:\test.txt", 1)

RunAsSet ($UserName, "domain", $Password)

FileWrite("c:\test.txt", @MON)

FileWrite("c:\test.txt", ":")

FileWrite("c:\test.txt", @MDAY)

FileWrite("c:\test.txt", @TAB)

FileWrite("c:\test.txt", @HOUR)

FileWrite("c:\test.txt", ":")

FileWrite("c:\test.txt", @MIN)

FileWrite("c:\test.txt", @TAB)

FileWrite("c:\test.txt", $pc)

FileWrite("c:\test.txt", @TAB)

FileWrite("c:\test.txt", $username)

FileWrite("c:\test.txt", @CRLF)

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

RunAsSet()

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

RunAsSet is for "Run" commands... all other commands aren't related. If you need to filewrite with admin rights, then use runasset and rerun the script...

Lar.

<{POST_SNAPBACK}>

Kinda hard to explain why I'm doing this, my company wants to have generic accounts in our library for web browsing, but we won't do that since we can't track who goes to what web page with generic web accounts. I planned on making a text file on each machine, the generic account would not have rights to it, but when the user launches my script (which will eventually execute IE), I want their user data appended to this file with their permissions since the generic account will not be able to write to it. So I need the RunAsSet to work with a users account, not necessarily an admin

....just got what you said about using the run command with it

Edited by mattress

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