disbale netbios over tcpip with USB network cards

Started by pamsniffer, April 20, 2015, 11:31:18 AM

Previous topic - Next topic

pamsniffer

hi,
We are using USB network adapter and want to disable netbios over tcpip, but due the use of USB de interface is de NIC is not fixed.
IS there a way to disable netbios tcpip over all adapter

some code found but works only for a fixed adapter need som extra help.

insRoot = regopenkey(@regmachine,"SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces")
NicReg = regopenkey(WinsRoot,"Tcpip_{974CB562-BB31-4E89-BA72-5B64150DE5F5}") ; This tells it what nic to look at, you may need to check on your pc
OldSetting = regqueryvalue(nicReg,"[NetbiosOptions]")
regsetvalue(NicReg,"[NetbiosOptions]",0) ; Use Netbios setting from DHCP Server
regsetvalue(NicReg,"[NetbiosOptions]",1) ; Enable Netbios over TCP/IP
regsetvalue(NicReg,"[NetbiosOptions]",2) ; Disable Netbios over TCP/IP
regclosekey(NicReg)
regclosekey(WinsRoot)

Pam

td

NetBios over tcp ip can't be disabled via group policy so you would need to cycle through all the  adapters under 'intrfaces' and disable each in turn.   Of course the trick would be to do this after your USB adapter is present on the system.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

One way to handle checking for additional interface would be to set up a scheduled task.  Another would be to create a service script that performed background checking on a regular bases.  In ether case, the RegQueryKeys function could be used to obtain the current list of network interfaces as defined in the Registry.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

pamsniffer

Hi,
An other way is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces
There are about 17 adapter below this interface is there a way to disable all the change the NetbiosOptions=0 to 2 on all the interfaces

pam

td

Is this a question?  if so, what I think you are describing is what the previous two responses were about.  You can use RegQueryKeys to get the key names of those 17 adapters under 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces'.  Once you have the names you can concatenate each name to the registry path and  change the NetbiosOPtions value  of each key to 2.

If I am not interpreting your post correctly, I apologize and please explain further.

"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

pamsniffer

Hi,
Sorry my English is not so good, it was a question how to do that.

Pam

td

My written English leaves a lot to be desired so I can empathize.  Looks like it is time for a bare bones example:
Code (winbatch) Select

; Get a list of registered interface.
strRegIface = 'SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces'
hIfaces     = RegOpenKey(@REGMACHINE, strRegIface)
lIfaces     = RegQueryKeys(hIfaces)

; Disable all interfaces.
nIfaces     = ItemCount(lIfaces, @Tab)
for i = 1 to nIfaces
   RegSetValue(hIfaces, ItemExtract(i, lIfaces, @Tab):'[NetbiosOptions]','2')
next

RegCloseKey(hIfaces)
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade


td

I inadvertently left a break statement in the above script when I originally posted the script.  It has since been removed.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade