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

  • From: "Sullivan, Glenn" <GSullivan@xxxxxxxxxxxxxx>
  • To: <windows2000@xxxxxxxxxxxxx>
  • Date: Wed, 4 Apr 2007 15:20:07 -0400

Absolutely... A startup script would be the right place for this to run.

I personally would clean it up a bit...

Const DISABLED = 2
Set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set nics = objWMIService.ExecQuery("SELECT * FROM
Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each nic in nics
  intNetBT = nic.SetTCPIPNetBIOS(DISABLED) 
Next

That should be only 6 lines... They should start with:
1. Const
2. Set
3. Set
4. For
5. intNetBT
6. next

I have to ask though... Why?  I can't ever think of a time that I wanted
it disabled, never mind on ALL my machines...

Glenn Sullivan, MCSE+I MCDBA
David Clark Company Inc. 
-----Original Message-----
From: windows2000-bounce@xxxxxxxxxxxxx
[mailto:windows2000-bounce@xxxxxxxxxxxxx] On Behalf Of Sorin Srbu
Posted At: Wednesday, April 04, 2007 10:27 AM
Posted To: Windows 2000
Conversation: [windows2000] Re: Disabling Netbios over TCP/IP?
Subject: [windows2000] Re: Disabling Netbios over TCP/IP?


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\I
nterfa
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
*****************************
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: