After working with Windows 8 apps since the release once thing that has bugged me is the 3 month expiration on the developer license. For instance if I have a Windows 8 solution open and try to run it with an expired license then I get this prompt.
If I select “Cancel” then I just get this error.
If I select “I agree” then everything is fine again and I can proceed. I’d like to schedule a task to run automatically to renew my license before it expires.
Enter PowerShell and Task Scheduler
Open PowerShell as an Administrator and see when your next license expires by calling Get-WindowsDeveloperLicense as shown below.
PS C:\Windows\system32> Get-WindowsDeveloperLicense ExpirationTime IsValid -------------- ------- 10/21/2013 2:58:40 PM True
Create a PowerShell script with the following information and save the file with a name of something like License.ps1.
You can also use the one found here.
- Launch Task Scheduler and create a “Basic Task” and give it a description.
- Select Monthly on the next screen and give it a date before it is set to expire. (You can tweak the settings later)
- On action select “Start a program” with the following path : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe (If you are using Windows 8)
- Under Add Arguments give it the full path to the file you created earlier. Be sure to keep the format identical to this: ("C:\Users\Michael\Desktop\license.ps1")
Your task should now be created. Double click on the task and select “Run with highest privileges.” as shown below.
This is necessary as you need elevated privileges to renew your license.
Run the task from Task Scheduler and if you get this error “cannot be loaded because running scripts is disabled on this computer” switch back to an Administrator PowerShell prompt and enter the following:
PS C:\Windows\system32> set-executionpolicy remotesigned Execution Policy Change The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic at http://go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy? [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): PS C:\Windows\system32>
If you run the task now you should get the prompt to renew.
There you go you can now renew before your license expires.