# vs15 17 19社区版重置许可证 **Repository Path**: stevent095/VSCELicense ## Basic Information - **Project Name**: vs15 17 19社区版重置许可证 - **Description**: 转自https://github.com/1Dimitri/VSCELicense - **Primary Language**: C# - **License**: MS-PL - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 5 - **Created**: 2024-02-05 - **Last Updated**: 2024-02-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 📜 VSCELicense - [Details](#details) 详情 - [Usage](#usage) 使用 - [Examples](#examples) 例子 - [Get Visual Studio Community Edition license expiration date](#get-visual-studio-community-edition-license-expiration-date) 获取Visual Studio社区版许可证到期日期 - [Set Visual Studio Community Edition license expiration date](#set-visual-studio-community-edition-license-expiration-date) 设置Visual Studio社区版许可证到期日期 - [Set license expiration date to 31 day from now](#set-license-expiration-date-to-31-days-from-nowy) 将许可证到期日期设置为从现在起31天 - [Set license expiration date to 10 days from now](#set-license-expiration-date-to-10-days-from-now) 将许可证到期日期设置为10天后 - [Set license expiration date to current date](#set-license-expiration-date-to-current-date) 将许可证到期日期设置为当前日期 - [Changelog](#changelog) 变更日志 ## Details PowerShell module to get and set Visual Studio Community Edition license expiration date in the registry. Visual Studio 2015, 2017 and 2019 are supported. PowerShell模块,用于在注册表中获取和设置Visual Studio Community Edition许可证到期日期。支持Visual Studio 2015、2017和2019。 Based on [Dmitrii](https://stackoverflow.com/users/10046552/dmitrii)'s answer to this question: [Visual Studio Community 2017 is a 30 day trial?](https://stackoverflow.com/questions/43390466/visual-studio-community-2017-is-a-30-day-trial/51570570#51570570) 基于Dmitrii对这个问题的回答:Visual Studio Community 2017是一个30天的试用期? ## Forked version benefits 分叉版本优势 This forked version includes the source to build MSI Installers that will:此分叉版本包括用于生成MSI安装程序的源代码,该安装程序将: 1. Install the module in the well-known Powershell path using embedded files for non-connected environments 使用用于非连接环境的嵌入式文件,在众所周知的Powershell路径中安装模块 2. Create a scheduled task to run it every night as SYSTEM. 创建一个计划任务,每天晚上以SYSTEM的形式运行。 The MSI Installers are built using the [WixSharp](https://github.com/oleg-shilo/wixsharp) project, the task scheduler manipulation is made using [TaskScheduler](https://github.com/dahall/taskscheduler), a .NET Wrapper for the Task Scheduler COM Interface. MSI安装程序是使用WixSharp项目构建的,任务调度程序操作是使用TaskScheduler进行的。用于任务计划程序COM接口的.NET包装程序。 ## Simplified Forked version usage 简化的分叉版本使用 1. Run the MSI based on the platform of your choice found in Releases 基于您在Release中选择的平台运行MSI 2. A task, visible as administrator, is created in the 'VSCELicense' folder of the local scheduled tasks library. Your can change its schedule if needed, based on operational constraints 在本地计划任务库的“VSCELicense”文件夹中创建了一个以管理员身份可见的任务。如果需要,您可以根据操作限制更改其时间表 ## Original Module Usage 原始模块使用 1. Download/clone this repository 2. Run PowerShell.exe as Administrator 3. Import module: Assuming that you cloned/downloaded this repo to `C:\VSCELicense` 假设您将此回购克隆/下载到 ```pwsh Import-Module -Name 'C:\VSCELicense\VSCELicense.psd1' ``` If you get `execution of scripts is disabled on this system` message, you can temporarily override PowerShell execution policy by running 如果收到“在此系统上禁用脚本执行”消息,则可以通过运行 ```pwsh Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process ``` See PowerShell documentation for more details: 有关更多详细信息,请参阅PowerShell文档: - [Set-ExecutionPolicy](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy) - [About Execution Policies](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies) 关于执行策略 ## Examples 例子 ### Get Visual Studio Community Edition license expiration date 获取Visual Studio社区版许可证到期日期 All supported versions of Visual Studio. 所有支持的Visual Studio版本。 ```pwsh Get-VSCELicenseExpirationDate ``` One specific version of Visual Studio. ```pwsh Get-VSCELicenseExpirationDate -Version 2017 ``` Multiple versions of Visual Studio. ```pwsh Get-VSCELicenseExpirationDate -Version 2019, 2017 ``` ### Set Visual Studio Community Edition license expiration date 设置Visual Studio社区版许可证到期日期 ⚡ Writing to the Visual Studio license registry key requires elevated permissions. Run PowerShell as administrator for examples to work. 写入Visual Studio许可证注册表项需要提升权限。以管理员身份运行PowerShell以使示例正常工作。 #### Set license expiration date to 31 day from now 将许可证到期日期设置为从现在起31天 All supported versions of Visual Studio. 所有支持的Visual Studio版本。 ```pwsh Set-VSCELicenseExpirationDate ``` One specific version of Visual Studio. Visual Studio的一个特定版本。 ```pwsh Set-VSCELicenseExpirationDate -Version 2017 ``` Multiple versions of Visual Studio. Visual Studio的多个版本。 ```pwsh Set-VSCELicenseExpirationDate -Version 2019, 2017 ``` #### Set license expiration date to 10 days from now 将许可证到期日期设置为10天后 All supported versions of Visual Studio. 所有支持的Visual Studio版本。 ```pwsh Set-VSCELicenseExpirationDate -AddDays 10 ``` One specific version of Visual Studio. Visual Studio的一个特定版本。 ```pwsh Set-VSCELicenseExpirationDate -Version 2017 -AddDays 10 ``` Multiple versions of Visual Studio. Visual Studio的多个版本。 ```pwsh Set-VSCELicenseExpirationDate -Version 2019, 2017 -AddDays 10 ``` #### Set license expiration date to current date 将许可证到期日期设置为当前日期 ⚡ This will immediately expire your license and you wouldn't be able to use Visual Studio. All supported versions of Visual Studio. ```pwsh Set-VSCELicenseExpirationDate -AddDays 0 ``` One specific version of Visual Studio. ```pwsh Set-VSCELicenseExpirationDate -Version 2017 -AddDays 0 ``` Multiple versions of Visual Studio. ```pwsh Set-VSCELicenseExpirationDate -Version 2019, 2017 -AddDays 0 ``` ### Changelog - 0.0.8 - Make it easier to use by not requiring to specify Visual Studio version - 0.0.7 - Added 2015 support ([@GDI123](https://github.com/GDI123)) - 0.0.6 - Load `System.Security` assembly if module was imported without manifest - 0.0.5 - Duh, actually set `PowerShellVersion = '3.0'` in manifest - 0.0.4 - Support downlevel PowerShell versions, starting from `3.0` - 0.0.3 - Fixed manifest to avoid execution errors under fresh PowerShell environments ([@1Dimitri](https://github.com/1Dimitri)) - 0.0.2 - Added 2019 support - 0.0.1 - Initial commit, 2017 support