Set Network Location automation during Windows 7 Audit mode.

When automating installation of Windows 7 and booting to Audit mode you may see the “Set Network Location” prompting you to set Home, Public, or Work Network. If this is an issue for you and you would like to close this window. The following sample script worked for me to close the windows as part of automated installation.

Copy the following to a text file and save as: Closewin.vbs:

Set WshShell = Wscript.CreateObject("WScript.Shell")
Do While Not Wshshell.AppActivate ("Set Network Location")
Wscript.sleep 100
Wshshell.AppActivate "Set Network Location"
Wshshell.SendKeys "%{F4}"

Calling VBS script from autounattend.xml using the ‘RunAsynchronousCommand’ (Synchronous command will wait and not work):

    <settings pass="auditUser">
        <component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="" xmlns:xsi="">
                <RunAsynchronousCommand wcm:action="add">
                    <Description>Close Window</Description>
                    <Path>wscript e:\closewin.vbs</Path>
                </RunAsynchronousCommand >

Comments (1)

  1. Beaudge says:

    Do you know of a way to control this with GPO? I would like to simply disable this prompt for everyone no matter what network they connect to