By The Scripting Guys, Microsoft Corporation

This script enables popups for specific sites by editing the registry using the WMI System Registry provider. The default value for Windows XP Service Pack 2 is to not allow any popups.

AllowPop-wmi.vbs corresponds to AllowPop.vbs, one of the scripts that ships with Application Compatibility Testing and Mitigation Guide for Windows XP Service Pack 2 and which are documented in the Appendix. You can download a Windows Installer (.msi) file that installs the Guide and its associated scripts from:

To use the script, copy the code, paste it into Notepad, and then save the script as allowpop-wmi.vbs. To run the script, open a command prompt window to the directory of the script and type:

cscript allowpop-wmi.vbs

If the default script host on the computer is Cscript.exe, the initial "cscript" may be omitted.

Script Code

'Author: Peter Costantini, the Microsoft Scripting Guys
'Date: 9/13/04
'Revision 1.0
'This script edits the registry to permit popups for specific sites.
'The default value for Windows XP Service Pack 2 is not to allow any popups.
'Each registry entry is the URL of a site without "http://".
'The value for each site must be a binary array with one element of 0.

On Error Resume Next

'Global constants and variables
strComputer = "." ' Can be changed to name of remote computer.

'Connect with WMI service and StdRegProv class.
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
 strComputer & "\root\default:StdRegProv")
If Err = 0 Then
'Change reg entries.
  WScript.Echo "Unable to connect to WMI service on " & strComputer & "."
    WScript.Echo "  Error Number:" & Err.Number
    WScript.Echo "  Source:" & Err.Source
    WScript.Echo "  Description:" & Err.Description
End If


Sub SetValues

'Local constants and variables
Const HKEY_CURRENT_USER = &H80000001
strKeyPath = "Software\Microsoft\Internet Explorer\New Windows\Allow"
'Array of web site names, truncating "http://"
arrEntries = Array("*", "*", "*")
arrValues = Array(&H0)

'Set registry entry for each array element.
For i = 0 To UBound(arrEntries)
  intReturn = objReg.SetBinaryValue(HKEY_CURRENT_USER, strKeyPath, _
   arrEntries(i), arrValues)
  If intReturn = 0 Then
    strSites = strSites & VbCrLf & arrEntries(i)
    strErrors = strErrors & VbCrLf & arrEntries(i) & ": " & intReturn
  End If
'List new registry entries and errors.
WScript.Echo "Enabled popups for the following sites:" & strSites
If Not IsEmpty(strErrors) Then
  WScript.Echo "Error: Unable to enable popups for the following sites:" & _
End If
'List all sites on which popups are now enabled.
WScript.Echo VbCrLf & "Popups now enabled for the following sites:"
intReturn = objReg.EnumValues(HKEY_CURRENT_USER, strKeyPath, _
   arrAllEntries, arrAllValues)
For i = 0 To UBound(arrAllEntries)
  WScript.Echo arrAllEntries(i)

End Sub

For online peer support, join The Official Scripting Guys Forum! To provide feedback or report bugs in sample scripts, please start a new discussion on the Discussions tab for this script.


This sample script is not supported under any Microsoft standard support program or service. The sample script is provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.