jezr74 Posted May 8, 2008 Share Posted May 8, 2008 Hi There, I searched topics and read and re-read the help files, but I am obviously confused how to do a section of a script I am working on, shown below. I am attempting to have my script determin it's geographical location by determinging the logon server DC that it authenticates against. This will then determine which servers it will access to further run scripts.. but I am stumbling around the first part of having it pass on the correct location information. I've added a tray tip to easily feed me back the results so i can test and have run on a box in another geographical location to test... but while it passes on the correct DC, it does'nt seems to pass on the location and deploymentserver string. I'm thinking this is a fairly simple solution, but I have blocked myself into thinking one way... anyone able to take a look and give me some clues on what I'm doing wrong? CODE $strLogonServer = @LogonServer $strDeploymentServer = "UNKNOWN" ;Detect Site Location and allocate deployment server If $strLogonServer = "MELDC1" or "MELDC2" or "MELDC3" Then $strLocation = "Melbourne AUS" $strDeploymentServer = "MELSVR0" ElseIf $strLogonServer = "SYDDC1" or "SYDDC2" Then $strLocation = "Sydney AUS" $strDeploymentServer = "SYDSVR0" Else $strLocation = "Not Detected" $strDeploymentServer = "UNKNOWN" EndIf TrayTip("Site Detection","Found " & $strLogonServer &" at "& $strLocation &" using "& $strDeploymentServer & " deployment server",100,1) Sleep(3000) Thanks, Jtsm Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 8, 2008 Share Posted May 8, 2008 Hi There, I searched topics and read and re-read the help files, but I am obviously confused how to do a section of a script I am working on, shown below. I am attempting to have my script determin it's geographical location by determinging the logon server DC that it authenticates against. This will then determine which servers it will access to further run scripts.. but I am stumbling around the first part of having it pass on the correct location information. I've added a tray tip to easily feed me back the results so i can test and have run on a box in another geographical location to test... but while it passes on the correct DC, it does'nt seems to pass on the location and deploymentserver string. I'm thinking this is a fairly simple solution, but I have blocked myself into thinking one way... anyone able to take a look and give me some clues on what I'm doing wrong? CODE $strLogonServer = @LogonServer $strDeploymentServer = "UNKNOWN" ;Detect Site Location and allocate deployment server If $strLogonServer = "MELDC1" or "MELDC2" or "MELDC3" Then $strLocation = "Melbourne AUS" $strDeploymentServer = "MELSVR0" ElseIf $strLogonServer = "SYDDC1" or "SYDDC2" Then $strLocation = "Sydney AUS" $strDeploymentServer = "SYDSVR0" Else $strLocation = "Not Detected" $strDeploymentServer = "UNKNOWN" EndIf TrayTip("Site Detection","Found " & $strLogonServer &" at "& $strLocation &" using "& $strDeploymentServer & " deployment server",100,1) Sleep(3000) If you structure your If condition that way it will have to be: If $strLogonServer = "MELDC1" or $strLogonServer = "MELDC2" or $strLogonServer = "MELDC3" Then This is less awkward: ; Default values $strLocation = "Not Detected" $strDeploymentServer = "UNKNOWN" ; Detect Site Location and allocate deployment server Switch @LogonServer Case "MELDC1", "MELDC2", "MELDC3" $strLocation = "Melbourne AUS" $strDeploymentServer = "MELSVR0" Case "SYDDC1", "SYDDC2" $strLocation = "Sydney AUS" $strDeploymentServer = "SYDSVR0" EndSwitch Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
jezr74 Posted May 8, 2008 Author Share Posted May 8, 2008 Thank you, looks much cleaner, and works. I did forget to add the '\\' to the server names as well. Which @LogonServer Returns. Thanks again, Jtsm 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