[windows2000] Re: Disabling Netbios over TCP/IP?

  • From: "Sorin Srbu" <sorin.srbu@xxxxxxxxxxxxx>
  • To: <windows2000@xxxxxxxxxxxxx>
  • Date: Wed, 4 Apr 2007 16:27:24 +0200

Sorin Srbu <mailto:sorin.srbu@xxxxxxxxxxxxx> wrote on Wednesday, April 04,
2007 4:19 PM:

Hmm... This vb-script seems to disable on the test-box silently:

---
' This code enables NetBIOS over TCP/IP
' ------ SCRIPT CONFIGURATION ------
strComputer = "."

Const DEFAULT = 0
Const ENABLED = 1
Const DISABLED = 2
' ------ END CONFIGURATION ---------

Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set nics = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

For Each nic in nics
  intNetBT = nic.SetTCPIPNetBIOS(DISABLED)
Next
---

Can vbscripts be run as startup-scripts? In the System-context? I don't think
I've actually ever run a vb-script at startup...

TIA.


> Sorin Srbu <mailto:sorin.srbu@xxxxxxxxxxxxx> wrote on Wednesday, April 04,
> 2007 3:26 PM: 
> 
> Ok, after some more googling I found this reg-file:
> 
> ---
>
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfa
ces\Tcp_{<Interface
> GUID>}\] "NetbiosOptions"=dword:0 (to use DHCP settings)
> "NetbiosOptions"=dword:1 (to enable NetBIOS over TCP/IP)
> "NetbiosOptions"=dword:2 (to disable NetBIOS over TCP/IP)
> ---
> 
> However now the problem is that the tcp-{interface-GUID} is probably
> different on every single computer... Any idea on how to do this, either
> for all NICS found in a system or the "primary" NIC?  
> 
> Also found this vb-script, but am not sure how to interpret it:
> 
> ---
> ' From the book "Windows Server 2003 Networking Recipes"
> 
> ' This code enables NetBIOS over TCP/IP
> ' ------ SCRIPT CONFIGURATION ------
> strComputer = "."
> 
> Const DEFAULT = 0
> Const ENABLED = 1
> Const DISABLED = 2
> ' ------ END CONFIGURATION ---------
> 
> Set objWMIService = GetObject("winmgmts:" _
>  & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
> 
> Set nics = objWMIService.ExecQuery _
>  ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
> 
> For Each nic in nics
>   intNetBT = nic.SetTCPIPNetBIOS(ENABLED)
>   If intNetBT = 0 Then
>     WScript.Echo "Success! NetBIOS over TCP/IP enabled!"
>   ElseIf intNetBT = 1 Then
>     WScript.Echo "Success! NetBIOS over TCP/IP enabled, please reboot."
>   Else
>     WScript.Echo "Error! Unable to enable NetBIOS over TCP/IP."
>   End If
> Next
> ---
> 
> All that happens when I run the script is that it pops up a few squares
> with "netbios enabled!" I don't want it to enable it, quite the contrary. I
> gues that the several popups is because I have several NIC:s in the test
> system. Otherwise it seems to work, ie it enables netbios over tcp/ip.   
> 
> Is it enough if I change "intNetBT = nic.SetTCPIPNetBIOS(ENABLED)" to
> "intNetBT = nic.SetTCPIPNetBIOS(DISABLED)". My knowledge with vb-scripting
> is weak...  
> 
> Also, if I don't want the popups, what would I remove from the script? The
> "Wscript.echo..."-thingies? 
> 
> Thx for your help in advance. 8*}
> 
> 
>> Hi all,
>> 
>> Isn't there *any* way to programmatically disable Netbios over TCP/IP? We
>> use static IP:s so setting it on the dhcp-server isn't an option. All
>> answers I find on Google seems to point to the graphical GUI, which isn't
>> very helpful if you want to change a couple of dozen machines or so...
>> 
>> Anybody?

*****************************
New Site from The Kenzig Group!
Windows Vista Links, list options 
and info are available at:
http://www.VistaPop.com
***************************** 
To Unsubscribe, set digest or vacation
mode or view archives use the below link.

http://thethin.net/win2000list.cfm

Other related posts: