GregThompson Posted November 6, 2006 Share Posted November 6, 2006 I could write a start script that tells my main script to run as whatever user I want, but, what I would LIKE to do is sort of combine the 2 into 1. What I mean is.. I'd like a single script that checks to see who it's running as, and if it's not the specific user it needs to be, restarts itself running as the correct user. It should be simple enough to do using the RunAsSet command, however the first 1/2 eludes me? How do I check to see who the script is running as in the first place? Link to comment Share on other sites More sharing options...
Developers Jos Posted November 6, 2006 Developers Share Posted November 6, 2006 I could write a start script that tells my main script to run as whatever user I want, but, what I would LIKE to do is sort of combine the 2 into 1. What I mean is.. I'd like a single script that checks to see who it's running as, and if it's not the specific user it needs to be, restarts itself running as the correct user. It should be simple enough to do using the RunAsSet command, however the first 1/2 eludes me? How do I check to see who the script is running as in the first place?If @UserName <> "Flip" then RunAsSet ("Flip", @Computername, "Katrien") Run('"' & @ScriptFullPath & '"' ) 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 More sharing options...
Xenobiologist Posted November 6, 2006 Share Posted November 6, 2006 Hi, what is the goal of your task? Preventing users to start your script? Doing things always with one user? Is it a network pc or stand alone? So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
GregThompson Posted November 6, 2006 Author Share Posted November 6, 2006 If @UserName <> "Flip" then RunAsSet ("Flip", @Computername, "Katrien") Run('"' & @ScriptFullPath & '"' ) if @error = 1 then msgbox(48,"Error","cannot start ... wrong admin userid or psw") exit EndIfJdeB - @UserName determines the currently logged on user, not who the script is running as, thank you though. Hi, what is the goal of your task? Preventing users to start your script? Doing things always with one user? Is it a network pc or stand alone? So long, Mega The goal is to always have the script start as a specific user no matter who starts it, the thing is, the user is a service account, so, in theory no one should ever be loggin on as that account. A "starter script" is easiet I know, but I wanted to get a little more fancy ya know? I didn't think I could user the @UserName variable because I thought it read from the winlogon hive, and the script would just keep on looping since the service account isn't logged on. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 6, 2006 Developers Share Posted November 6, 2006 JdeB - @UserName determines the currently logged on user, not who the script is running as, thank you though.Did you try it ? 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 More sharing options...
Developers Jos Posted November 6, 2006 Developers Share Posted November 6, 2006 (edited) Did you try it ?mmhh think you are right .... back to the drawingboard...Nope works as i thought it does.... try it.. Edited November 6, 2006 by JdeB 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 More sharing options...
GregThompson Posted November 6, 2006 Author Share Posted November 6, 2006 mmhh think you are right .... back to the drawingboard...Nope works as i thought it does.... try it..I did try it, and I stand corrected. Thank you much! You may have a cookie now. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 6, 2006 Developers Share Posted November 6, 2006 ...You may have a cookie now. Only one ? 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now