2

I'm looking for a way to enable NetBios on all servers in my domain for a limited time of about a month and later i am supposed to disable it again (it is used by some inventory application we are using). Do you have any idea how to achieve this goal? Powershell script would be nice.

Bryan
  • 7,628
  • 15
  • 69
  • 94
Itai Ganot
  • 10,644
  • 29
  • 93
  • 146

2 Answers2

6

The following script will do what you want via PowerShell. You will need a text file with the name of each server on a line. The script assumes that there is one active NIC on each system. If you have multiple active NICs, you would need to loop through them, setting on each.

$computers = Get-Content -Path "S:\ome path\to text file.txt"

foreach ($computer in $computers)
{
    $NIC = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled = true" -ComputerName $computer
    $NIC.SetTcpipNetbios("1")
}

If you have all of your servers in one OU, you could use the QuestAD cmdlets to pull all of them into the $computers variable, then pass the name that way.

Christopher
  • 1,673
  • 12
  • 17
2

Use Wmic

Create a separate text file that contains a CSV list or a carriage-return-delimited list of computer names called somefile.txt

Then run the following commands from an appropriate permissioned account:

wmic /node:@somefile.txt /interactive:off nicconfig where TcpipNetbiosOptions=0 call SetTcpipNetbios 1
wmic /node:@somefile.txt /interactive:off nicconfig where TcpipNetbiosOptions=2 call SetTcpipNetbios 1

When you are done change the above code to SetTcpipNetbios to 2 (disabled). (0 is set via DHCP)

Nate
  • 3,378
  • 15
  • 21