自建KMS

本文最后更新于(2017-10-20 10:09:13),链接可能失效,内容可能难以复现。请注意甄别。
引用:https://blog.csdn.net/SarenTumulus/article/details/90814938 这里可以找到Windows激活密钥:https://technet.microsoft.com/en-us/library/jj612867.aspx
下载地址:https://github.com/Wind4/vlmcsd/releases

搭建Windows的服务器

  1. 复制Windows/intel/vlmcsd-Windows-x64.exe到C:\Windows\System32\vlmcsd.exe
  2. 依次运行以下命令:
    # Create System Service
    sc create KMSSrv binpath= %windir%\System32\vlmcsd.exe type= own start= auto displayname= "KMS Emulator" 
    # Run Vlmcsd
    net start KMSSrv 
    # Open Port:1688
    netsh advfirewall firewall add rule name="KMS Emulator Server" dir=in action=allow protocol=TCP localport=1688

测试Windows的服务器(可选)

  1. 复制Windows/intel/vlmcs-Windows-x64.exe到C:\Windows\SysWOW64\vlmcs.exe
  2. 在C:\Windows\SysWOW64\内运行以下命令来测试激活服务器是否搭建成功:
    C:\Windows\SysWOW64>vlmcs.exe -v -l 3 服务器IP地址
    
    Request Parameters
    ==================
    
    Protocol version                : 6.0
    Client is a virtual machine     : No
    Licensing status                : 2 (OOB grace)
    Remaining time (0 = forever)    : 43200 minutes
    Application ID                  : 55c92734-d682-4d71-983e-d6ec3f16059f (Windows)
    SKU ID (aka Activation ID)      : 34e1ae55-27f8-4950-8877-7a03be5fb181 (Windows Server 2019 Datacenter)
    KMS ID (aka KMS counted ID)     : 8449b1fb-f0ea-497a-99ab-66ca96e9a0f5 (Windows Server 2019)
    Client machine ID               : e9fa706d-ffdf-41c4-aad9-83fbb427cfa5
    Previous client machine ID      : 00000000-0000-0000-0000-000000000000
    Client request timestamp (UTC)  : 2020-02-15 14:01:13
    Workstation name                : ns1.samsung.pl
    N count policy (minimum clients): 5
    
    Connecting to [::1]:1688 ... successful
    
    Performing RPC bind ...
    ... NDR64 ... BTFN ... NDR32 ... successful
    Sending activation request (KMS V6) 1 of 1
    
    Response from KMS server
    ========================
    
    Size of KMS Response            : 260 (0x104)
    Protocol version                : 6.0
    KMS host extended PID           : 06401-00206-555-733862-03-3079-9600.0000-1992019
    KMS host Hardware ID            : 3A1C049600B60076
    Client machine ID               : e9fa706d-ffdf-41c4-aad9-83fbb427cfa5
    Client request timestamp (UTC)  : 2020-02-15 14:01:13
    KMS host current active clients : 50
    Renewal interval policy         : 10080
    Activation interval policy      : 120
以下为附加: 《微软产品KMS激活指南》

Windows激活命令:

删除指定密钥:
slmgr /upk XXXX-XXXX-XXXX-XXXX-XXXX
删除所有密钥:
slmgr /upk
安装密钥:
slmgr /ipk XXXX-XXXX-XXXX-XXXX-XXXX
设置激活服务器地址:
slmgr /skms 服务器IP地址:1688
激活Windows:
slmgr /ato
验证有效期:
slmgr /xpr

Office 2010+激活命令:

切换到Office安装路径 \Microsoft Office\OfficeXX(2016为Office16) 删除指定密钥(密钥最后5位):
cscript ospp.vbs /unpkey:XXXXX
删除所有密钥:
cscript ospp.vbs /unpkey
安装密钥:
cscript ospp.vbs /inpkey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
设置激活服务器地址:
cscript ospp.vbs /sethst:服务器IP地址
cscript ospp.vbs /setprt:1688
激活Office:
cscript ospp.vbs /act
验证有效期:
cscript ospp.vbs /dstatus
零售版转VOL版*:
cscript ospp.vbs /rearm
for /f %%x in ('dir /b ..\root\Licenses16\proplusvl_kms*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul
for /f %%x in ('dir /b ..\root\Licenses16\proplusvl_mak*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul