obtain the Logonserver's Name from a Win98 client 
Author Message
 obtain the Logonserver's Name from a Win98 client

Is it possible without use of wmi (because it is not installed on the
clients)?

Robert



Sun, 26 Dec 2004 04:59:21 GMT  
 obtain the Logonserver's Name from a Win98 client

Quote:

> Is it possible without use of wmi (because it is not installed on the
> clients)?

From a couple of earlier threads:

<qoute>

Subject: Re: Logon Server
Newsgroups: microsoft.public.scripting.wsh
Date: 2000/08/03

Make sure that the .bat file executes the script with the syntax:

wscript %0\..\mylogon.vbs

Then in mylogon.vbs you can parse the server name from the
wscript.scriptfullname which will be a
UNC path (\\servername\sharename\mylogon.vbs)...

--
Michael Harris
MVP Scripting
</qoute>

<qoute>

Subject: Re: create environment variable in windows 95
Newsgroups: microsoft.public.scripting.wsh
Date: 2002-03-13 10:14:13 PST

Hi Richard,

how about that...I used it before, when I had W9x workstations. I guess, you
call the script from a \Netlogon share on a DC...

'-------------------------------------------------------------------
Set WshNetwork = CreateObject("WScript.Network")

Do Until strScriptFullName <> "" And WshNetwork.UserName <> ""
  strScriptFullName = Wscript.ScriptFullName
  WScript.Sleep 100
Loop
' the loop is needed, because W9x machines need a short time
' to respond to this function during logon

' let's enumerate the LOGONSERVER for compatibility with NT4+W9x workstations
strServer = mid(strScriptFullName, 1, instr(3,strScriptFullName,"\")-1)
strUser = WshNetwork.UserName
'-------------------------------------------------------------------

This should work...just give it a try! :-)
Greetings from Berlin, Germany

Andr
</qoute>

If you want to put it in the global environment, Winset.exe/Putinenv.exe may be
used. Take a look at this article for more info:


Subject: Re: create environment variable in windows 95
Newsgroups: microsoft.public.scripting.wsh
Date: 2002-03-12 17:30:38 PST
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3C8E...

--
torgeir



Sun, 26 Dec 2004 07:12:10 GMT  
 obtain the Logonserver's Name from a Win98 client
Here is another one:

<qoute>

Subject: Re: parse network env vars win98 logon script
Newsgroups: microsoft.public.scripting.wsh
Date: 2001-02-25 13:04:08 PST

Those environment variables aren't available on Win9x
clients...

To get the logonserver...

In your logon.bat file, execute the script as:

    start cscript %0\..\logon.vbs

Then in the logon.vbs file WScript.ScriptFullName will be
in full UNC format:

\\servername\NETLOGON\logon.vbs

sScriptPath = wscript.scriptfullname

if left(sScriptPath,2) = "\\" then
  logonserver = split(sScriptPath,"\")(2)
else
  logonserver = "localhost"
end if

msgbox logonserver

To get UserDomain on Win9x during logon, see:

Q188602 - INFO: UserDomain Method Does Not Work Under
Win95 with WSH
http://support.microsoft.com/support/kb/articles/Q188/6/02.
ASP

--
Michael Harris
Microsoft.MVP.Scripting
</qoute>



Sun, 26 Dec 2004 07:22:24 GMT  
 obtain the Logonserver's Name from a Win98 client
Here's a very lightly modified form of that turned into a function
(getting the domain name):

Function Domain
 Dim regDom, regWrkgrp, Net, Sh, Env
 regDom ="HKLM\SYSTEM\CurrentControlSet\Services\" _
  & "MSNP32\ NetworkProvider\AuthenticatingAgent"
 regWrkgrp = "HKLM\SYSTEM\CurrentControlSet\Services\" _
  & "VxD\VNETSUP\Workgroup"
 Set Net = CreateObject("Wscript.Network")
 Set Sh = CreateObject("Wscript.Shell")
 Set Env = Sh.Environment
 If (Env("OS") = "Windows_NT") Then
  Domain = Net.UserDomain
 Else
  Domain = Sh.RegRead(regDom)
  If (Domain = "") Then
   Domain = Sh.RegRead(regWrkgrp)
  End If
 End If
End Function

--
Please respond in the newsgroup.  I've still got unread email from the
week Win95 was released, if that tells you anything.
http://www.bittnet.com/winremote
http://www.bittnet.com/scripting


Quote:
> Here is another one:

> <qoute>

> Subject: Re: parse network env vars win98 logon script
> Newsgroups: microsoft.public.scripting.wsh
> Date: 2001-02-25 13:04:08 PST

> Those environment variables aren't available on Win9x
> clients...

> To get the logonserver...

> In your logon.bat file, execute the script as:

>     start cscript %0\..\logon.vbs

> Then in the logon.vbs file WScript.ScriptFullName will be
> in full UNC format:

> \\servername\NETLOGON\logon.vbs

> sScriptPath = wscript.scriptfullname

> if left(sScriptPath,2) = "\\" then
>   logonserver = split(sScriptPath,"\")(2)
> else
>   logonserver = "localhost"
> end if

> msgbox logonserver

> To get UserDomain on Win9x during logon, see:

> Q188602 - INFO: UserDomain Method Does Not Work Under
> Win95 with WSH
> http://support.microsoft.com/support/kb/articles/Q188/6/02.
> ASP

> --
> Michael Harris
> Microsoft.MVP.Scripting
> </qoute>



Sun, 26 Dec 2004 08:43:38 GMT  
 obtain the Logonserver's Name from a Win98 client
You could call the command line and echo it to file or more.

From command line type:

Echo %logonserver% >> C:\return.txt
Then pull it out of the text file return.txt.

jAckzXz


Quote:
> Is it possible without use of wmi (because it is not installed on the
> clients)?

> Robert



Sun, 26 Dec 2004 13:29:32 GMT  
 obtain the Logonserver's Name from a Win98 client

Quote:

> You could call the command line and echo it to file or more.

> From command line type:

> Echo %logonserver% >> C:\return.txt
> Then pull it out of the text file return.txt.

Hi

That environment variable isn't available on Win9x, only on NT-based clients.
The original poster has Win98.

--
torgeir



Sun, 26 Dec 2004 19:01:35 GMT  
 obtain the Logonserver's Name from a Win98 client

Torgeir (, Michael):

wscript.scriptfullname begins with the mapped Network drive letter. In wich
case it could begin with the server's name?

Alex:
Getting the domain name is ok (in the case the computer is logged on to a
domain - else domain() gets the local PC name).

Robert



Thu, 30 Dec 2004 03:04:24 GMT  
 obtain the Logonserver's Name from a Win98 client
You're saying that wscript.fullname gives you a drive letter path
instead of a UNC path?

Here's a function that will return the hosting server for any script
executed off a network path.  SInce you are using Win98, you should be
forewarned that you might have problems with the WScript.Network object
initializing rapidly enough...

WScript.Echo Scriptserver
Function Scriptserver
 Dim ScriptPath, FSO, basepath, Net, i, NetDrives, pos
 Scriptserver= ""
 ScriptPath = WScript.ScriptFullname
 Set FSO = CreateObject("Scripting.FileSystemObject")
 basepath = FSO.GetDriveName(ScriptPath)
 If Len(basepath) = 2 Then
  Set Net = CreateObject("WScript.Network")
  Set NetDrives = Net.EnumNetworkDrives
  For i = 0 to NetDrives.Count - 1 Step 2
   If NetDrives.Item(i) = basepath Then
    basepath = NetDrives.Item(i+1)
    Exit For
   End If
  Next
 End If
 If Len(basepath)>2 Then
  pos = InStrRev(basepath, "\")
  Scriptserver= Mid(basepath, 3, pos - 3)
 End If
End Function

--
Please respond in the newsgroup.  I've still got unread email from the
week Win95 was released, if that tells you anything.
http://www.bittnet.com/winremote
http://www.bittnet.com/scripting


Quote:

> Torgeir (, Michael):

> wscript.scriptfullname begins with the mapped Network drive letter. In
wich
> case it could begin with the server's name?

> Alex:
> Getting the domain name is ok (in the case the computer is logged on
to a
> domain - else domain() gets the local PC name).

> Robert



Thu, 30 Dec 2004 03:47:02 GMT  
 obtain the Logonserver's Name from a Win98 client
Alex,

it was the right idea!

thanks
Robert



Thu, 30 Dec 2004 05:15:02 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Another way to get the name of the logonserver for Win9x clients

2. Obtaining Client's Computername with Client-side Jscript

3. How to obtain member's name of an object

4. Obtain DController name which I'm currently verified

5. Obtaining client IP address client side

6. Obtaining client IP address client side

7. Obtaining client IP address client side

8. Get logonserver from Win9x clients

9. Obtaining table names/field names from Access @ runtime

10. Getting client side machine's name.

11. get client's ip / host-name

12. Getting client side machine's name.

 

 
Powered by phpBB® Forum Software