Enable Netbios over TCP (Perl)
This code can be found in
Chapter 3 of Windows Server 2003 Security Cookbook
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the Perl code from this site.
# This code enables/disables the Netbios over TCP/IP setting.
# ------ SCRIPT CONFIGURATION ------
use Win32::OLE qw(in);
use constant SET_NETBIOS => 2;
# 0 = Use setting from DHCP; 1 = Enable; 2 = Disable
$strComputer = '.';
# ------ END CONFIGURATION ---------
$objWMIService = Win32::OLE->GetObject('winmgmts:\\\\' . $strComputer . '\\root\\cimv2');
$colNicConfigs = $objWMIService->ExecQuery('SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True');
foreach my $objNicConfig (in $colNicConfigs) {
$intNetBIOS = $objNicConfig->SetTCPIPNetBIOS(SET_NETBIOS);
print $objNicConfig->Description . ': successfully set NetBIOS over TCP/IP to ' . SET_NETBIOS, "\n";
}
|
This code has been viewed 1026 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|