Home All Groups Group Topic Archive Search About

code to parse logon servername and exit if name start w/abc*



Author
22 Nov 2007 12:05 AM
Smoreno
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

Author
22 Nov 2007 8:48 PM
Andrew Karmadanov
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
Author
24 Nov 2007 3:10 AM
Al Dunbar
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

AddThis Social Bookmark Button