Trial period reset of Visual Studio Community Edition 15


Although Visual Studio Community Edition is supposed to be free, you are required after 30 days by the graphical interface to have an account on Microsoft’s online services to continue to use the product. The trial period reset of Visual Studio Community Edition can however be easily achieved by editing the registry.

As mentioned in this StackOverflow question, the expiration date for these 30 days are registered in a registry value protected by the CryptProtectData API. The algorithm is then

  1. Get the value in HKCR\Licenses\5C505A59-E312-4B89-9508-E162F8150517\08878 for VSCE 2017 or HKCR\Licenses\41717607-F34E-432C-A138-A3CFD7E25CDA\09278 for VCSE 2019
  2. Decrypt the value with CryptUnprotectData.
  3. Get and change the values in bytes -16,-15 (YY), -14,-13 (MM), -12, -11 (DD)
  4. Encrypt the value with CryptProtectData.
  5. Set the value back in the registry where you found it.

In Powershell, a module has been published which does this. However, the manifest was not properly edited, so you can find an updated version with the following changes:

  1. CompatiblePSEditions is valid for Powershell 5.1 or higher
  2. The RequiredAssemblies to load, in this case System.Security for the Cryptography functions, directive takes an array of strings, not a simple string

If you want a ready-to-use solution, i.e. a MSI Installer which installs the module without the need for an internet connection and a scheduled task to periodically reset the period, just go to thegithub repo for this project.


Leave a comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

15 thoughts on “Trial period reset of Visual Studio Community Edition

  • Anonymouse

    Thanks for the script đŸ™‚
    Here is the howTo that was asked for:

    Make a directory for the 2 files (VSCELicense.psm1 and VSCELicense.psd1) and make the two files with copy pasting and notepad or your favorite editor
    put all files in the same directory and start a powershell with admin priviledges.

    In the following lines change vs2019 to the version you have installed.

    Then type (or copy paste. You might have to copy paste and execut every line individually.):

    #StartOfCommands

    Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process

    $currentDirectory = Get-Location

    Import-Module $currentDirectory\VSCELicense

    Get-VSCELicenseExpirationDate

    Set-VSCELicenseExpirationDate -Version 2019

    Get-VSCELicenseExpirationDate

    Remove-Module VSCELicense

    #EndOfCommands
    —–

    If you close the powershell window the priviledges will revert to what they were before.
    Just open a new one and type:

    Get-ExecutionPolicy -list

    đŸ™‚ Done!

    • Alexis PERROTTEY

      This doesn’t work anymore.

      Get-VSCELicenseExpirationDate crashes with an error on Date

      ConvertFrom-BinaryDate : Cannot validate argument on parameter ‘Year’. The -1 argument is less than the minimum
      allowed range of 1. Supply an argument that is greater than or equal to 1 and then try the command again.
      At C:\Reset Visual Studio\VSCELicense.psm1:176 char:38
      + … ationDate = ConvertFrom-BinaryDate $LicenseBlob[-16..-11] -ErrorActio …
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo : InvalidData: (:) [ConvertFrom-BinaryDate], ParameterBindingValidationException
      + FullyQualifiedErrorId : ParameterArgumentValidationError,ConvertFrom-BinaryDate