For the tray icon subroutine, I added the ability to specify the DNS suffix to the interface "Local Area Connection". Not entirely necessary, but a nice feature when working in the enterprise.
Quote
Const HKLM = &H80000002
Const REG_SZ = 1
Const REG_DWORD = 4
Dim strComputer
strComputer="."
'**********************************************************************
'** Subroutine; Disable NetBIOS from all interfaces **
'**********************************************************************
Sub NetBTDisable
Dim objReg, strKeyPath, strNBTOptions, dwNBTOptions, arrSubKeys, SubKey, FullKey, arrEntryNames, arrValueTypes, i, dwValue
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces"
strNBTOptions = "NetbiosOptions"
dwNBTOptions = 2
objReg.EnumKey HKLM, strKeyPath, arrSubKeys
For Each SubKey In arrSubKeys
FullKey = strKeyPath & "\" & SubKey
objReg.EnumValues HKLM, FullKey, arrEntryNames, arrValueTypes
For i=0 To UBound(arrEntryNames)
Select Case arrValueTypes(i)
Case REG_DWORD
objReg.GetDWORDValue HKLM, FullKey, arrEntryNames(i),dwValue
If arrEntryNames(i) = strNBTOptions Then objReg.SetDWORDValue HKLM, FullKey, strNBTOptions, dwNBTOptions
End Select
Next
Next
End Sub
'**********************************************************************
'** Subroutine; Show the tray icon for "Local Area Connection" **
'**********************************************************************
Sub ShowNetTrayIcon
Dim objReg, strKeyPath, strKeyPath2, strShowIcon, dwShowIcon, strDomainKey, strDomain, arrSubKeys
Dim SubKey, FullKey, FullKey2, arrEntryNames, arrValueTypes, i, strValue
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}"
strKeyPath2 = "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces"
strShowIcon = "ShowIcon"
strDomainKey = "Domain"
strDomain = "MyDomain.Local"
dwShowIcon = 1
objReg.EnumKey HKLM, strKeyPath, arrSubKeys
For Each SubKey In arrSubKeys
If SubKey <> "Descriptions" Then
FullKey = strKeyPath & "\" & SubKey & "\Connection\"
FullKey2 = strKeyPath2 & "\" & SubKey
objReg.EnumValues HKLM, FullKey, arrEntryNames, arrValueTypes
For i=0 To UBound(arrEntryNames)
Select Case arrValueTypes(i)
Case REG_SZ
objReg.GetStringValue HKLM, FullKey, arrEntryNames(i),strValue
If strValue = "Local Area Connection" Then
objReg.SetDWORDValue HKLM, FullKey, strShowIcon, dwShowIcon
objReg.SetStringValue HKLM, FullKey2, strDomainKey, strDomain
End If
End Select
Next
End If
Next
End Sub
'**********************************************************************
'** Run tasks **
'**********************************************************************
NetBTDisable
ShowNetTrayIcon
Don't forget to change the strDomain = "MyDomain.Local" to whatever your domain is.



Help

Back to top










