Disable manage server screen2 (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 the Manage/Configure Your Server screen for
# the currently logged on user.
# ---------------------------------------------------------------
# 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 ------
$intEnable = 0; # 0 = disable screen; 1 = enable screen
$strComputer = '.';
# ------ END CONFIGURATION ---------
use constant HKCU => 0x80000001;
$strKeyPath = 'Software\\Microsoft\\Windows NT\\CurrentVersion\\' . 'Setup\\Welcome\\srvWiz';
$objReg = Win32::OLE->GetObject('winmgmts:\\\\' . $strComputer . '\\root\\default:StdRegProv');
$intRC = $objReg->SetDwordValue(HKCU, $strKeyPath, '', $intEnable);
if ($intRC != 0) {
    print 'Error setting registry value: ' . $intRC, "\n";
}
else {
    print "Successfully disabled screen\n";
}

This code has been viewed 706 times.

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