Windows Server Cookbook for Windows Server 2003 and Windows 2000
Recipe 2.1. Activating Windows Server 2003
Problem
You want to activate o r view the activation status of a Windows Server 2003 system. Microsoft requires that you activate Windows Server 2003 within 30 days of installation to validate you have a legal copy of the software. Solution
Using a graphical user interface
Using a command-line interface
The following command opens the Activation wizard described in the previous section: > %systemroot%\system32\oobe\msoobe /a There are no options that can activate the computer silently from the command line. Using VBScript
' This code activates a Windows Server 2003 system. ' ------ SCRIPT CONFIGURATION ------ strComputer = "." boolActivateOnline = True ' If this is true, boolActivateOffline should ' be false boolActivateOffline = False ' If this is true, boolActivateOnline should ' be false strOfflineConfirmationCode = "1234-5678" ' if Activating offline, you need ' specify a confirmation code ' ------ END CONFIGURATION --------- set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set colWPA = objWMI.InstancesOf("Win32_WindowsProductActivation") for each objWPA in colWPA WScript.Echo "Activation Settings:" Wscript.Echo " Activation Required: " & objWPA.ActivationRequired Wscript.Echo " Caption: " & objWPA.Caption Wscript.Echo " Description: " & objWPA.Description Wscript.Echo " Notification On: " & objWPA.IsNotificationOn Wscript.Echo " Product ID: " & objWPA.ProductID Wscript.Echo " Remaining Eval Period: " & objWPA.RemainingEvaluationPeriod Wscript.Echo " Remaining Grace Period: " & objWPA.RemainingGracePeriod Wscript.Echo " Server Name: " & objWPA.ServerName Wscript.Echo " Setting ID: " & objWPA.SettingID WScript.Echo if objWPA.ActivationRequired = True then if boolActivateOnline = True then intRC = objWPA.ActivateOnline if intRC <> 0 then WScript.Echo "Error activating online: " & intRC else WScript.Echo "Successfully activated online" end if end if if boolActivateOffline = True then intRC = objWPA.ActivateOffline(strOfflineConfirmationCode) if intRC <> 0 then WScript.Echo "Error activating offline: " & intRC else WScript.Echo "Successfully activated offline" end if end if end if next Discussion
Microsoft estimates that it has lost billions of dollars due to pirated, or illegally copied, software. Microsoft Product Activation (MPA) is a new technology used to reduce software piracy. Microsoft has integrated MPA into their most recent operating systems (i.e., Windows XP and Windows Server 2003) and some consumer applications (e.g., Microsoft Office). MPA is designed to prevent casual copying. For example, let's say you buy a single copy of Windows XP from Best Buy, install it on your computer, and then lend the CD to a friend who installs it on his computer. The second copy is considered pirated and not legitimate under MPA. MPA is an umbrella term for the various Microsoft activation technologies such as Windows Product Activation (WPA) and Office Activation Wizard (OAW). You can run an unactivated copy of Windows for up to 30 days before you must activate it to use the system further. Over those 30 days, you are periodically reminded to activate Windows via a pop-up window from the system tray. The longer you wait the more frequent these notifications become. And they can be down right aggravating if you don't plan to activate the system for a number of days. Fortunately, you can disable these notifications. Here is a small script that does it: strComputer = "." set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set colWPA = objWMI.InstancesOf("Win32_WindowsProductActivation") for each objWPA in colWPA objWPA.SetNotification(0) next
Just don't forget that you still need to activate the system! The activation process is an anonymous and relatively quick operation. No personally identifiable information is needed to activate the product. There are three different ways you can activate Windows. First, you can use a broadband connection over the Internet. This requires that ports 80 and 443 (HTTP and HTTPS) are open through your firewall, which if you use the Internet they undoubtedly are. Second, WPA can automatically connect to the Internet using a modem. And third, you can call a toll-free number to activate it over the phone. If you have questions about WPA, see MS KB 302878, which is the MPA FAQ. See Also
MS KB 291983 (Ports That Are Used by Windows Product Activation), MS KB 291997 (How to Activate Windows XP Using an Unattend.txt File), MS KB 302806 (Description of Microsoft Product Activation), MS KB 302878 (Frequently Asked Questions about Microsoft Product Activation), MS KB 325510 (Support WebCast: Microsoft Windows XP and Office XP: Understanding the New Mandatory Product Activation), and MS KB 326851 (Activation and Registration of a Microsoft Product) |