Disable windows update (Perl)

This code can be found in Chapter 2 of Windows Server 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 disables Windows Update in the .Default profile.
# ---------------------------------------------------------------
# Adapted from VBScript code contained in the book:
#      "Windows Server Cookbook" by Robbie Allen
# ISBN: 0-596-00633-0
# ---------------------------------------------------------------

use Win32::OLE;
$Win32::OLE::Warn = 3;

# ------ SCRIPT CONFIGURATION ------
$strComputer = '.';
# ------ END CONFIGURATION ---------
use constant HKEY_USERS => 0x80000003;
$strKey = '.DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer';
$objReg = Win32::OLE->GetObject('winmgmts:\\\\' . $strComputer . '\\root\\default:StdRegProv');
$objReg->SetDwordValue(HKEY_USERS, $strKey, 'NoWindowsUpdate', 1);
print "Windows Update disabled in .Default profile\n";

This code has been viewed 945 times.

New from the creators of TechTasks.com: StatSheet.com