|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
code to parse logon servername and exit if name start w/abc*
I have the following code on a login script to read the logon server name: Set WSHShell = CreateObject("Wscript.Shell") Set WSHProcess = WSHShell.Environment("Process") LogonServer = WSHProcess("LogonServer") But now I am not sure how to parse the 'Logonserver' name to and skip ahead in the script if the first 5 letters of the name are 'abcde' so what I need is something like: If logonserver name starts with 'abcde' then go to end Wscript.echo " some data" End Any help will be appreciated -- Smoreno - ADOT Should look like this:
LogonServer = UCase(Trim(LogonServer)) If Mid(LogonServer,1,5) <> "ABCDE" then Wscript.echo " some data" Else End If Show quote "Smoreno" wrote: > Hello, > > I have the following code on a login script to read the logon server name: > Set WSHShell = CreateObject("Wscript.Shell") > Set WSHProcess = WSHShell.Environment("Process") > LogonServer = WSHProcess("LogonServer") > > But now I am not sure how to parse the 'Logonserver' name to and skip ahead > in the script if the first 5 letters of the name are 'abcde' > > so what I need is something like: > > If logonserver name starts with 'abcde' then go to end > Wscript.echo " some data" > End > > Any help will be appreciated > -- > Smoreno - ADOT Since the logonserver variable always shows the name prefixed with "\\",
this might be marginally simpler: LogonServer = UCase(Trim(LogonServer)) If Left(LogonServer,7) <> "\\ABCDE" then Wscript.echo " some data" End If /Al Show quote "Andrew Karmadanov" <AndrewKarmada***@discussions.microsoft.com> wrote in message news:50CB9CC9-926A-4251-B161-993D459B467C@microsoft.com... > Should look like this: > > LogonServer = UCase(Trim(LogonServer)) > If Mid(LogonServer,1,5) <> "ABCDE" then > Wscript.echo " some data" > Else > End If > > > "Smoreno" wrote: > >> Hello, >> >> I have the following code on a login script to read the logon server >> name: >> Set WSHShell = CreateObject("Wscript.Shell") >> Set WSHProcess = WSHShell.Environment("Process") >> LogonServer = WSHProcess("LogonServer") >> >> But now I am not sure how to parse the 'Logonserver' name to and skip >> ahead >> in the script if the first 5 letters of the name are 'abcde' >> >> so what I need is something like: >> >> If logonserver name starts with 'abcde' then go to end >> Wscript.echo " some data" >> End >> >> Any help will be appreciated >> -- >> Smoreno - ADOT |
|||||||||||||||||||||||