HJAdams123 Posted November 13, 2014 Posted November 13, 2014 Hello and Good Day AutoIT Community.... I am trying to use the %LOGONSERVER% variable in a RunAs() statment, and its not working...hope you can tell me what I am going wrong.... In Windows, the %LOGONSERVER% variable is used to tell you what domain controller your session is currentlly using. I am trying to leverage that in the following code.... ; Script Start - Add your code below here Local $DomainController = EnvGet("LOGONSERVER") RunAs("User", "domain FQDN", "Password", 0, "$DomainControllerNETLOGONBatchCommand.cmd") So in the above code, I am using the EnvGent() command to retrieve the LOGONSERVER environment variable and send that to a variable called $DomainController I then simply want to run a command thats in the NETLOGON share of our domain controllers.... Am I using the $DomainController variable wrong in the last part of the RunAs command? I noticed that the $DomainController part does not show grey, so I don't think Autoit is recognizing the fact that its a variable. What am I doing wrong here? Thanks for any help you can provide....
Moderators Solution JLogan3o13 Posted November 13, 2014 Moderators Solution Posted November 13, 2014 Common mistake, you have your variable inside your quotes. Try this: Local $DomainController = EnvGet("LOGONSERVER") RunAs("User", "domain FQDN", "Password", 0, $DomainController & "\NETLOGON\BatchCommand.cmd") "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
jguinch Posted November 13, 2014 Posted November 13, 2014 Local $DomainController = EnvGet("LOGONSERVER") RunAs("User", "domain FQDN", "Password", 0, $DomainController & "\NETLOGON\BatchCommand.cmd") Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
HJAdams123 Posted November 13, 2014 Author Posted November 13, 2014 Hey jguinch and Jlogan3o13... Guess what you are? You two are awesome, that's what you are.... That was it. Thanks!
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