Windows8 Room

Windows 8 Basics, Tips, Tricks and other related useful Infos

When developing or evaluating Store App, developer license is required to install and run unsigned Apps. But, license only lasts for 30 days, and it expires without any warnings or notifications. You might wonder your testing App simply showing “This app can’t open” and no clue what is going wrong (developer license expired, that is).

When license expired, you can renew from Visual Studio, or run PowerShell and enter

Show-WindowsDeveloperLicenseRegistration

to call license update window.

I’ve created PowerShell script to make check license status and update easier.

param(
    [switch]$GetDeveloperLicense = $false
)

$ScriptPath = $null
try
{
    $ScriptPath = (Get-Variable MyInvocation).Value.MyCommand.Path
    $ScriptDir = Split-Path -Parent $ScriptPath
}
catch {}

function CheckIfNeedDeveloperLicense
{
	$Result = $true
	try
	{
		$Result = (Get-WindowsDeveloperLicense | Where-Object { $_.IsValid }).Count -eq 0
	}
	catch {}

	return $Result
}

if ($GetDeveloperLicense)
{
        try
        {
            Show-WindowsDeveloperLicenseRegistration
        }
        catch
        {
            $Error[0] # Dump details about the last error
            Write-Host $UiStrings.ErrorGetDeveloperLicenseFailed
        }
		Start-Sleep -Seconds 5
}
else{
	Get-WindowsDeveloperLicense
	if (CheckIfNeedDeveloperLicense)
	{
		try
		{
	    	$RelaunchArgs = '-ExecutionPolicy Unrestricted -file "' + $ScriptPath + '"' + ' -GetDeveloperLicense'
			$AdminProcess = Start-Process "$PsHome\PowerShell.exe" -windowstyle hidden -Verb RunAs -ArgumentList $RelaunchArgs -PassThru
		}
		catch
		{
       		$Error[0] # Dump details about the last error
			Write-Host $UiStrings.ErrorLaunchAdminFailed
		}
	}
	else
	{
		Write-Host "License Valid"
		Start-Sleep -Seconds 3
	}
}

Copy paste above code to notepad, and save to filename like “renewlic.ps1”. Right click file and select “Run with PowerShell”

If license is invalid, it will show license update window, and shows license info for 3 seconds if it is still valid.

run script

developer license

valid thru

Modify and register to startup or task scheduler to manager license more easier.


This post is also available in: Japanese

Leave a Reply

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


*