How to Block or Allow the Windows 10 Reservation


Post to Twitter Post to Facebook Post to StumbleUpon

by Susan Bradley, Robert Pearman and additional members of the small business IT community.

This is a powershell script to help either obtain the Windows 10 reservation icon on systems that are missing it, or block it from systems that are not behind a domain.

Remember when you are behind a domain you will NOT see this Windows 10 icon in the system tray.

First download the PowerShell script from this location – http://1drv.ms/1Fyh3dm and unblock it as coming from the web:

image

Figure 1 – remove mark of the web

Launch PowerShell and be sure to run as admin.

Set the PowerShell script policy to Set-ExecutionPolicy RemoteSigned. This allows the foreign script to run.

image

Now decide if you want to run the script to review what is missing, or to block the windows 10 icon

Review what is needed on the computer to GET to Windows 10 reservation      .\Get-GWX.ps1 -EnableGWX True /

Turn off the Windows 10 reservation Flag in the system tray         .\Get-GWX.ps1 -EnableGWX False /

.\ means you are running it from the directory it’s located in, be sure you are in the directory where you have downloaded the script.

What the script does: It checks that the machine is activated, and the checks for missing patches needed to reserve Windows 10.

image

In my case I’m behind a domain where several prerequisite patches were not placed on WSUS and thus are missing from this deployment.

Full copy of script

<#

.Synopsis

Check your computer for basic compatibility and readiness for the Windows 10 Free Upgrade.

.DESCRIPTION

Checks your PC for known requirements of Windows 10 GWX Program.

Using methods described in https://github.com/vlee489/Windows-10-reserve-fixer-

Thanks go to:

Quick-Method #1 ^[JC from answers.microsoft.com^]

Quick-Method #2 ^[KevinStevens_845 from answers.microsoft.com^]

Long-Method #1 ^[Yaqub K from answers.microsoft.com^]

.EXAMPLE

.\Get-GWX.ps1 -EnableGWX True / Will run the checks

.\Get-GWX.ps1 -EnableGWX False / Will turn off the Flag in the system tray

.INPUTS

Test string inputs of values requested. No Pipeline support.

.OUTPUTS

No Outputs.

.NOTES

Requires user to be running an Elevated PowerShell window.

.FUNCTIONALITY

A script to check rediness of GWX

#>

param(

[Parameter(Mandatory=$True,Position=0)]

[ValidateNotNull()]

[string]$EnableGWX

)

function Windows8

{

Write-Output “Checking Windows Version..” # 1

# Check Version

$version = (Get-WMIObject Win32_OperatingSystem).Version

$lowVersion = “6.3.9200”

if(($version) -lt $lowVersion)

{

Write-Output “You need to install the Windows 8.1 Update”

}

else

{

# Hotfix Check # 2

Write-Output “Checking for Hotfixes..”

$hotfixes = @(

“KB3035583”

)

$installed = @()

foreach ($hotfix in $hotfixes)

{

$missing = Get-Hotfix $hotfix -ErrorAction SilentlyContinue

if (($missing) -eq $null)

{

$installed += $hotfix

}

}

$count = ($installed | Measure-Object).Count

if (($count) -ne “0”)

{

Write-Output “You are missing some Updates:” # 3

Write-Output $installed

}

else

{

# Check for UpgradeExperienceIndicators Key # 4

Write-Output “Checking Registry..”

if(!(Test-Path “HKLM:\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\UpgradeExperienceIndicators”))

{

# Registry Entries Missing # 5

Write-Output “Error in Registry UpgradeExperienceIndicators!”

}

else

{

Write-Output “Checking Registry Values..” # 6

if ((Get-ItemProperty -Path “HKLM:\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\UpgradeExperienceIndicators”).UpgEx -eq $null)

{

# Run Appraiser # 7

New-ItemProperty -Path “HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Appraiser” -Name UtcOnetimeSend -Value 1 -PropertyType DWORD -Force

Write-Output “Checking Appraiser Task..”

$taskName = ‘Microsoft Compatibility Appraiser’

$task = Get-ScheduledTask $taskName

if (($task) -eq $null)

{

Write-Output “Task $taskName is Missing!” # 8

}

else

{

# Run Appraiser wait until Completed # 9

$task = Get-ScheduledTask $taskName

Write-Output “Starting $taskName Please Wait..”

Start-ScheduledTask -TaskName $task.TaskName -TaskPath $task.TaskPath

do

{

$task = Get-ScheduledTask $taskName

Write-Output $task.State

}

until ($task.State -eq “Ready”)

Write-Output “$taskName Complete” # 10

Write-Output “Refresh GWX Config..”

Start-Process $env:SystemRoot\System32\GWX\GWXConfigManager.exe /RefreshConfig

}

}

else

{

Write-Output “Checking GWX Flag..” # 11

$flagColour = (Get-ItemProperty “HKLM:\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\UpgradeExperienceIndicators”).UpgEx

if (($flagColour) -ne “Green”)

{

New-ItemProperty -Path “HKLM:\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\UpgradeExperienceIndicators” -Name “UpgEX” -PropertyType “String” -Value “Green” -Force

}

# Check GWX is not Running # 12

Write-Output “Checking GWX.exe..”

$process = Get-Process -Name GWX -ErrorAction SilentlyContinue

if (($process) -eq $null)

{

# Launch GWX.exe # 13

Start-Process $env:SystemRoot\System32\GWX\GWX.exe

}

else

{

# Process Running Refresh Config # 14

Start-Process $env:SystemRoot\System32\GWX\GWXConfigManager.exe /RefreshConfig

}

}

}

}

}

Write-Output “Windows 10 Checker Finished” # 15

}

function Windows7

{

# Check Version

Write-Output “Checking Windows Version..” # 1

$version = (Get-WMIObject Win32_OperatingSystem).Version

$lowVersion = “6.1.7601”

if(($version) -lt $lowVersion)

{

Write-Output “You need to install Windows 7 SP1”

}

else

{

# Hotfix Check # 2

Write-Output “Checking for Hotfixes..”

$hotfixes = @(

“KB3035583”,

“KB2952664”

)

$installed = @()

foreach ($hotfix in $hotfixes)

{

$missing = Get-Hotfix $hotfix -ErrorAction SilentlyContinue

if (($missing) -eq $null)

{

$installed += $hotfix

}

}

$count = ($installed | Measure-Object).Count

if (($count) -ne “0”)

{

Write-Output “You are missing some Updates:” # 3

Write-Output $installed

}

else

{

# Check for UpgradeExperienceIndicators Key # 4

Write-Output “Checking Registry..”

if(!(Test-Path “HKLM:\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\UpgradeExperienceIndicators”))

{

# Registry Entries Missing # 5

Write-Output “Error in Registry UpgradeExperienceIndicators!”

}

else

{

Write-Output “Checking Registry Values” # 6

if ((Get-ItemProperty -Path “HKLM:\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\UpgradeExperienceIndicators”).UpgEx -eq $null)

{

# Run Appraiser # 7

New-ItemProperty -Path “HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Appraiser” -Name UtcOnetimeSend -Value 1 -PropertyType DWORD -Force

$taskName = ‘Microsoft Compatibility Appraiser’

$taskPath = “Microsoft\Windows\Application Experience”

$schedule = New-Object -ComObject “Schedule.Service”

$schedule.Connect(‘localhost’)

$folder = $schedule.GetFolder($path)

$task = $folder.GetTasks(1) | Where-Object { $_.Name -eq $taskName }

if (($task) -eq $null)

{

Write-Output “Task $taskName is Missing!” # 8

}

else

{

# Windows 7 Changes

# Run Appraiser wait until Completed # 9

Write-Output “Starting $taskName Please Wait..”

$taskRun = $tasKpath + “\” + $taskName

schtasks /run /TN $taskRun

do

{

$task = $folder.GetTasks(1) | Where-Object { $_.Name -eq $taskName }

Write-Output “Running”

}

until ($task.State -eq “3”)

Write-Output “$task Complete” # 10

Write-Output “Refresh GWX Config..”

Start-Process $env:SystemRoot\System32\GWX\GWXConfigManager.exe /RefreshConfig

}

}

else

{

Write-Output “Checking GWX Flag..” # 11

$flagColour = (Get-ItemProperty “HKLM:\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\UpgradeExperienceIndicators”).UpgEx

if (($flagColour) -ne “Green”)

{

New-ItemProperty -Path “HKLM:\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\UpgradeExperienceIndicators” -Name “UpgEX” -PropertyType “String” -Value “Green” -Force | Out-Null

}

# Check GWX is not Running # 12

Write-Output “Checking GWX.exe..”

$process = Get-Process -Name GWX -ErrorAction SilentlyContinue

if (($process) -eq $null)

{

# Launch GWX.exe # 13

Start-Process $env:SystemRoot\System32\GWX\GWX.exe

}

else

{

# Process Running Refresh Config #14

Start-Process $env:SystemRoot\System32\GWX\GWXConfigManager.exe /RefreshConfig

}

}

}

}

}

Write-Output “Windows 10 Checker Finished!” # 15

}

function DisableGWX

{

Write-Output “Disable GWX Flag..”

$path = “HKLM:\Software\Policies\Microsoft\Windows\GWX”

if(!(Test-Path $path))

{

New-Item $path | out-null

}

New-ItemProperty -Path $path -Name DisableGWX -PropertyType DWORD -Value 1 -Force | Out-Null

Stop-Process -ProcessName “GWX” -ErrorAction SilentlyContinue

}

function CheckOS

{

# Check OS

$os = ((Get-WMIObject Win32_OperatingSystem).Caption).ToString()

# Check for Disabled Flag

$path = “HKLM:\Software\Policies\Microsoft\Windows\GWX”

if(!(Test-Path $path))

{

# Path Not Exist

}

else

{

# Allow Flag to Show

Remove-ItemProperty -Path $path -Name DisableGWX -ErrorAction SilentlyContinue

}

# NOT Eligible For Free WX Upgrade Version

$upgrades = @(

“Microsoft Windows 7 Enterprise”

“Microsoft Windows 8 Enterprise”

“Microsoft Windows 8.1 Enterprise”

“Microsoft Windows RT”,

“Microsoft Windows Phone 8.0”

)

if (($upgrades) -Contains $os) # Windows 7 Unable to use method .contains

{

Write-Output “Your OS is not eligible to Upgrade to Windows 10”

}

else

{

if (($os) -like “Microsoft Windows 8*”)

{

Write-Output “Launch Pre-Requisite Checks? Last Chance to Cancel!”

$prompt = Read-Host -Prompt “C for Continue Q for Quit”

if (($prompt) -eq “C”)

{

windows8

}

else

{

Exit

}

}

if (($os) -like “Microsoft Windows 7*”)

{

Write-Output “Launch Pre-Requisite Checks? Last Chance to Cancel!”

$prompt = Read-Host -Prompt “C for Continue Q for Quit”

if (($prompt) -eq “C”)

{

windows7

}

else

{

Exit

}

}

}

}

Write-Output “Get Windows 10 Checker! v1.2”

Write-Output “by Susan Bradley Microsoft Security MVP”

Write-Output “Thanks to: JC, KevinStevens_84 and Yaqub K from answers.microsoft.com”

Write-Output “PowerShell Conversion by Robert Pearman http://titlerequired.com”

# Check for Elevation

if (!([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] “Administrator” ))

{

Write-Host “You must run PowerShell ‘As Administrator’ to use this tool.” -foregroundcolor YELLOW

Write-Host “”

Exit

}

else

{

# Check Activation

Write-Output “Checking Windows Activation..”

$activation = Get-WmiObject SoftwareLicensingProduct | where { ($_.Description -like “Windows*”) -and ( $_.LicenseStatus -eq “1” ) }

if (($activation) -eq $null)

{

Write-Output “Your copy of Windows is not Activated!”

}

else

{

$licenseType = $activation.Description

Write-Output “You are using: $licenseType.”

# Check Param

if (($EnableGWX) -eq “True”)

{

# Run Check OS Function

CheckOS

}

if (($EnableGWX) -eq “False”)

{

# Run Disable GWX Function

DisableGWX

}

}

}

_____

Not a Third Tier customer yet? Let me introduce:  We’re Third Tier. We provide advanced Third Tier support for IT Professionals and MicroStaffing for IT consulting firms. Come on over, create an account (no charge) and follow our social media locations. Attend our next chat or webinar: http://www.thirdtier.net/events

Third Tier Get Support BlogFeed Blog Twitter Twitter Facebook Facebook LinkedIn LinkedIN

Leave a comment

Your email address will not be published. Required fields are marked *

This blog is kept spam free by WP-SpamFree.