0

I'm trying to disable NetBIOS and need to do this over SCCM to multiple clients.

I am trying to do this through compliance settings and have the following in place (and they work when run locally)

Discovery Script

$adapter=(gwmi win32_networkadapterconfiguration | where {$_.ipenabled -eq "1"})
Foreach ($nic in $adapter) {if ($adapter.TcpIPNetBiosOptions -ne "2") {[System.Environment]::Exit(1)}} [System.Environment]::Exit(0)

Remediation script

$adapter=(gwmi win32_networkadapterconfiguration | where {$_.ipenabled -eq "1"})
Foreach ($nic in $adapter) {
$adapter.settcpipnetbios(2)
}

So running the script works on each machine locally and, if already compliant, SCCM is giving correct response

BUT

If the registry values returns as $adapter.TcpIPNetBiosOptions -ne "2" then the configuration compliance shows "error" when evaluated in Configuration Manager and the remediation does not trigger automatically. If I run the script myself then the configuration returns as compliant.

Is there something which I am missing?

Edit I see the following error being reported

Setting Discovery Error 0x80070001 Incorrect function. Windows

user001
  • 125
  • 1
  • 1
  • 10
  • Seeing as the correct result is being reported on machines with NetBIOS set to "2" I would assume that the issue is in the detection/return of value in the FOREACH/IF statement? – user001 Feb 26 '18 at 17:17

1 Answers1

1
$adapter.settcpipnetbios(2)

should be

$nic.settcpipnetbios(2)

Otherwise there would be no reason for the foreach loop.

chicks
  • 3,793
  • 10
  • 27
  • 36
Jimmy
  • 26
  • 1