Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

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.

share|improve this answer

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)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.