Link to home
Start Free TrialLog in
Avatar of Faust Romero
Faust RomeroFlag for United States of America

asked on

Disable NetBios Seeting via Group Policy

I have been trying to disable NetBIOS setting via Group Policy without luck. I have Windows 2012 R2 Domain Controllers, Windows server 2008 R2, windows 2008, and all windows client 8.1 and win 10. I have followed the following link to use scripts and to configure the Groups Policy under computer configuration->Policies->Windows settings->Scripts->Startup and attached the script as shown in the picture. Some windows are configured with manual IP address. All servers configure with manual IP address. The policy is applied on windows client OU, and Server OU.
In addition, I have also enabled on computer configuration ->Administrative templates->Systems->Scripts "Run startup scripts asynchronously", "Run startup scripts synchronously", "Specify maximum wait time for Group Policy scripts" with 60 seconds.
In addition, I have disabled UAC on one windows machine. User generated imageUser generated imageis there any else I am missing. I would like to do this through Group Policy and not manually on each server and computer.
Thanks a lot for suggestions.
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Please post Bat file
Avatar of Faust Romero

ASKER

Batch File below.


'  Title:      Configure NetBIOS over TCP/IP
'   Date:      2/25/2013
'Updated:
' Author:      Gregory Strike
'    URL:      http://www.gregorystrike.com/2013/02/25/configure-netbios-over-tcpip-group-policy.html
'
'Purpose:      The following script will itterate through all NICs on a computer
'              to configuure NetBIOS over TCP/IP.  It finds the NICs listed under:
'              HKLM\SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces
'
'              For each NIC under the key, it sets the NetbiosOptions value to one
'              of the below.  (Be sure to uncomment the setting you desire.)
'
'              0 - Default: Use DHCP setting from the DHCP Server
'              1 - Enable NetBIOS over TCP/IP
'              2 - Disable NetBIOS over TCP/IP
'
'Requirements: Administrative Privileges
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set ObjWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
'Set the path to the Network Interfaces
strKeyPath = "SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces"
'Get all the known interfaces
ObjWMI.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
'If there was a problem getting strKeyPath, exit the script before throwing an error.
If IsNull(arrSubKeys) Then WScript.Quit
WScript.Echo Now() & " - Searching for Network Adapaters."
'Loop through all Network Interface Cards and disable NetBIOS over TCP/IP
For Each Adapter In arrSubKeys
      WScript.Echo Now() & " - Disabling NetBIOS over TCP/IP on '" & Adapter & "'"
      'Default: Use DHCP setting from the DHCP Server
      'objWMI.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & Adapter, "NetbiosOptions", 0
      'Enable NetBIOS over TCP/IP
      'objWMI.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & Adapter, "NetbiosOptions", 1
      'Disable NetBIOS over TCP/IP
      objWMI.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & Adapter, "NetbiosOptions", 2
Next
WScript.Echo Now() & " - Completed."
ASKER CERTIFIED SOLUTION
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I Changed to PowerShell as attached. I also ran gpresult commands on one server, see attached. I omitted some information. as per the gpresult, the policy is being applied, however, I do not see that change in the NIC properties'. it stills shows in the default. User generated imageUser generated imagewhat else could be wrong? I am supposed to see the change don the NIC properties to confirm it is being applied correct?
C--Users-fausto.romero-Desktop-gpres.txt
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
it works via PowerShell with extension ps1 with script posted on computer policy. Thanks a lot.