0

I have a Windows GPO that runs a batch file startup script to disable NetBIOS. It normally looks like this:

wmic nicconfig where (TcpipNetbiosOptions!=null and TcpipNetbiosOptions!=2) call SetTcpipNetbios 2

However, I just found out that I have one particular computer that needs NetBIOS enabled. I didn't want to make an entire new GPO for this one machine and I also wasn't sure if it would override the other one, which is global. Excuse my Pseudo-code, but How can I make it so this command will only execute if the computers IP is not a certain one?

IF(<This IP Address> != 192.168.1.1)
wmic nicconfig where (TcpipNetbiosOptions!=null and TcpipNetbiosOptions!=2) call SetTcpipNetbios 2

Or is there a better idea?

1

1 Answer 1

1

Would the computer's hostname be sufficient, instead of IP Address?

IF %COMPUTERNAME% NEQ NetBIOSPC (wmic nicconfig where (TcpipNetbiosOptions!=null and TcpipNetbiosOptions!=2) call SetTcpipNetbios 2)

Obviously, replace NetBIOSPC with the actual hostname of the system. Be sure you're using the right hostname by typing hostname or echo %COMPUTERNAME% at the local CMD prompt on the target system.

2
  • Cool, thanks. Would this work? IF NOT "%IP%"=="192.168.1.1" (wmic nicconfig where (TcpipNetbiosOptions!=null and TcpipNetbiosOptions!=2) call SetTcpipNetbios 2)
    – TheFrack
    Jul 10, 2014 at 18:18
  • I wouldn't personally use IF NOT x == y where IF x NEQ y would be equally effective, but that's just a matter of personal preference. The only way you can use %IP% as an element in your conditional statement is if you have by some means already assigned the system's IP address to that variable - it is not a built-in environment variable, like %COMPUTERNAME% is.
    – Iszi
    Jul 10, 2014 at 19:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .