[windows2000] Re: remotely get network settings on Win2k machines

  • To: <windows2000@xxxxxxxxxxxxx>
  • Date: Thu, 2 Oct 2003 13:24:06 -0500

that rcmd.exe exectutable... do you think I might be able to use that to run 
ipconfig?

I'll look into playing with that vbscript in the meantime

thanks!



-----Original Message-----
From: windows2000-bounce@xxxxxxxxxxxxx
[mailto:windows2000-bounce@xxxxxxxxxxxxx]
Sent: Thursday, October 02, 2003 12:22
To: windows2000@xxxxxxxxxxxxx
Subject: [windows2000] Re: remotely get network settings on Win2k
machines


This is a big PITA, because you have to determine the NIC's ID in the
registry, if that's where you'd like to get the value.  I've done this
in the past, but my method was pretty flakey, if you ask me.  It seems
to work though.  IIRC correctly, I believe what I did depended on remote
command execution using rcmd.exe from the ResKit.  I'd copy out a .vbs
file to the machine and execute it.  Let me see if I can find it...

Okay, here are some vbscript functions that may get you somewhere.
Maybe not though!


Function ReturnAdapterName(iNicNum)
        '''HKLM\HARDWARE\OWNERMAP\PCI_0_a
        '''HKLM\Software\Microsoft\Windows
NT\CurrentVersion\NetworkCards\[#]\ServiceName
        
        '''Only 99% certain that NIC1 will be the appropriate NIC
        
        'On Error Resume Next
        
        Dim sResult, oShell
        
        Set oShell = CreateObject("WScript.Shell")
        sResult = oShell.RegRead("HKLM\Software\Microsoft\Windows
NT\CurrentVersion\NetworkCards\" & iNicNum & "\ServiceName")
        
        If sResult = "" Then sResult = "Unknown"
        
        ReturnAdapterName = sResult
        
        
End Function


Function ReturnOS()
        Dim sOS, oShell
        ''On Error Resume Next
        ReturnOS = "Unknown"
        
        Set oShell = CreateObject("WScript.Shell")
        Err.Clear
        sOS=UCase(oShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\CurrentBuildNumber"))
    If Err.Number <> 0 Then 
        Set oShell = Nothing
        Exit Function
    End If
        

        Select Case sOS
                Case "2600"      : ReturnOS="XP"
                Case "2195"  : ReturnOS="2000"
        Case "1381"  : ReturnOS="NT"
        End Select
        
        Set oShell = Nothing
End Function


Function ReturnNicNames(sOS)
        Dim oShell
        Set oShell = CreateObject("WScript.Shell")
        oShell.Run "regedit /E " & NIC_DUMP_FILE & "
""HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\NetworkCards""", , True
        Set oShell = Nothing
        '''reg dumped
        '''parse
        
        
        Dim aResult()
        Redim Preserve aResult(-1)
        
        Dim oFSO, oFile, i, sLine, aLine
        Set oFSO = CreateObject("Scripting.FileSystemObject")
        If oFSO.FileExists(NIC_DUMP_FILE) Then
                If UCase(sOS) = "NT" Then
                        Set oFile = oFSO.OpenTextFile(NIC_DUMP_FILE, 1,
0)
                Else
                        Set oFile = oFSO.OpenTextFile(NIC_DUMP_FILE, 1,
,-1)
                End If
                        For i = 1 To 4
                                oFile.SkipLine
                        Next
                        Do While Not oFile.AtEndOfStream
                                sLine = UCase(oFile.ReadLine)
                                If Instr(sLine, "[HKEY") = 1 Then
'''card num found
                                        sLine = Replace(sLine, "]", "")
                                        aLine = Split(sLine, "\")
                                        If UCase(aLine(UBound(aLine)-1))
= "NETWORKCARDS" Then   
                                                Redim Preserve
aResult(UBound(aResult) + 1)
                                                aResult(UBound(aResult))
= aLine(UBound(aLine))
                                        End If
                                End If
                        Loop
                
                
                
                oFile.Close
                Set oFile = Nothing
        End If
        Set oFSO = Nothing
        
        ReturnNicNames = aResult
        
End Function




Once you can ID the NIC in the registry, you can grab the gateway from
DefaultGateway in
HKLM\System\CurrentControlSet\Tcpip\Parameters\Interfaces\[NIC
ID]\DefaultGateway

Ray at work







> -----Original Message-----
> From: windows2000-bounce@xxxxxxxxxxxxx 
> [mailto:windows2000-bounce@xxxxxxxxxxxxx] 
> Sent: Thursday, October 02, 2003 11:56 AM
> To: windows2000@xxxxxxxxxxxxx
> Subject: [windows2000] remotely get network settings on Win2k machines
> 
> 
> I've been tasked with getting some network settings off a 
> sample of machines across a statewide WAN. The machines are 
> all win2k, set up with static IP addresses in an NT4 domain. 
> There's about 30 that I have to get. The main thing I'm 
> looking for is what the default gateway setting is for each 
> box (I already have the IP addresses). This is on a client's 
> network, so I don't really have access to every resource. 
> 
> Is there a command line method that I might be able to do 
> this? I can't think of anything other than ipconfig, but I 
> can't seem to find any switches that would allow for remote polling. 
> 
> or am I out of luck and will have to call each one of these 
> users and walk them thru it?
> 
> 
> thanks!
> 
> 
> Brian Anderson
> Serapis Support
> Correctional Medical Service
> Office (314)919-9868
> Pager  (888)945-8643
> Mobile (314)239-1398
> banderson@xxxxxxxxxx
> http://www.serapisonline.com  
> ********************************************************
> This Week's Sponsor - RTO Software / TScale
> What's keeping you from getting more from your terminal 
> servers? Did you know, in most cases, CPU Utilization IS NOT 
> the single biggest constraint to scaling up?! Get this free 
> white paper to understand the real constraints & how to 
> overcome them. SAVE MONEY by scaling-up rather than buying 
> more servers.
> http://www.rtosoft.com/Enter.asp?ID=147
> **********************************************************
> To Unsubscribe, set digest or vacation
> mode or view archives use the below link.
> 
http://thethin.net/win2000list.cfm


**********************************************************************************************************
The information contained in this e-mail message is intended only for the 
personal and confidential use
of the recipient(s) named above.  Distribution, publication, or retransmission 
of this message is strictly 
prohibited.  This message may be a bank to client communication and as such is 
priviliged and confidential.  
If the reader of this message is not the intended recipient or an agent 
responsible for delivering it to the 
intended recipient, you are hereby notified that you have received this 
document in error and that any 
review, dissemination, distribution, or copying of this message is strictly 
prohibited.  If you have received 
this communication in error, please notify us immediately by e-mail, and delete 
the original message.

The sender of this e-mail specifically "opts-out" of the Electronic Signatures 
and Global and National 
Commerce Act (E-Sign) and any and all similar state and federal acts.  
Accordingly, but without limitation, 
any and all documents, contracts, and ageements must contain a handwritten 
signature of the sender to
be legal, valid, and enforceable.
**********************************************************************************************************

********************************************************
This Week's Sponsor - RTO Software / TScale
What's keeping you from getting more from your terminal servers? Did you know, 
in most cases, CPU Utilization IS NOT the single biggest constraint to scaling 
up?! Get this free white paper to understand the real constraints & how to 
overcome them. SAVE MONEY by scaling-up rather than buying more servers.
http://www.rtosoft.com/Enter.asp?ID=147
**********************************************************
To Unsubscribe, set digest or vacation
mode or view archives use the below link.

http://thethin.net/win2000list.cfm
********************************************************
This Week's Sponsor - RTO Software / TScale
What's keeping you from getting more from your terminal servers? Did you know, 
in most cases, CPU Utilization IS NOT the single biggest constraint to scaling 
up?! Get this free white paper to understand the real constraints & how to 
overcome them. SAVE MONEY by scaling-up rather than buying more servers.
http://www.rtosoft.com/Enter.asp?ID=147
**********************************************************
To Unsubscribe, set digest or vacation
mode or view archives use the below link.

http://thethin.net/win2000list.cfm

Other related posts: