自建KMS服务器激活Windows office
一、KMS服务器环境介绍
操作系统Centos 7.x Windows Server 也是可以的,此处以Centos7为例安装,使用默认1688端口号
二、服务端安装过程:
1、下载安装包:
wget https://github.com/Wind4/vlmcsd/releases/download/svn1111/binaries.tar.gz /tmp
2、解压安装包:
tar -zxvf binaries.tar.gz
3、选择自己对应的系统版本,我这里选择Linux,选择Intel处理器,使用static中的vlmcsd-x64-musl-static,将文件拷贝至自己存放的目录:
1 mkdir /var/kms 2 cp /tmp/binaries/Linux/intel/static/vlmcsd-x64-musl-static /var/kms
4、添加执行权限运行服务
1 chmod +x /var/kms/vlmcsd-x64-musl-static 2 ./vlmcsd-x64-musl-static
5、放行防火墙端口,本服务使用的1688端口
1 firewall-cmd --zone=public --add-port=1688/tcp --permanent 2 firewall-cmd --reload
三、客户端激活操作(windows)
1、#配置序列号
slmgr /ipk xxxxx-xxxxx-xxxxx-xxxxx
2、#配置KMS服务器地址(可以是域名或者IP地址)
slmgr /skms xxxx
3、#激活系统
slmgr /ato
4、#查看系统激活到期时间
slmgr /xpr
5、#查看授权详细信息
slmgr /dlv
四、客户端激活操作(office)
1、先进入office安装目录:
1 #以下是office2016x64默认安装地址 2 cd "%ProgramFiles%\Microsoft Office\Office16" 3 #以下是office2016x86默认安装地址 4 cd "%ProgramFiles(x86)%\Microsoft Office\Office16"
2、#配置序列号
cscript ospp.vbs /inpkey:XXXXXXXXXXX
3、#配置KMS服务器地址,可以是域名或者IP地址
cscript ospp.vbs /sethst:xxxxxxx
4、#激活office
cscript ospp.vbs /act
5、查看激活状态
cscript ospp.vbs /dstatus
五、激活脚本:
1、office 2016/2019 激活脚本(如果是其它版本请修改路径后面的office16为其它版本)
1 @echo off
2 (cd /d "%~dp0")&&(NET FILE||(powershell start-process -FilePath ‘%0‘ -verb runas)&&(exit /B)) >NUL 2>&1 3 4 title Office 2019 Activator r/Piracy 5 echo Converting... & mode 40,25 6 7 (if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16")&(if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16")&(for /f %%x in (‘dir /b ..\root\Licenses16\ProPlus2019VL*.xrm-ms‘) do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&(for /f %%x in (‘dir /b ..\root\Licenses16\ProPlus2019VL*.xrm-ms‘) do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul) 8 cscript //nologo ospp.vbs /unpkey:6MWKP >nul&cscript //nologo ospp.vbs /inpkey:NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP >nul&set i=1 9 :server 10 #下面是KMS服务器地址,直接换成自建服务器地址或者IP即可 11 if %i%==1 set KMS_Sev=kms7.MSGuides.com 12 if %i%==2 set KMS_Sev=kms8.MSGuides.com 13 if %i%==3 set KMS_Sev=kms9.MSGuides.com 14 15 cscript //nologo ospp.vbs /sethst:%KMS_Sev% >nul 16 echo %KMS_Sev% & echo Activating... 17 cscript //nologo ospp.vbs /act | find /i "successful" && (echo 激活成功按任意键退出) || (echo Trying another KMS Server & set /a i+=1 & goto server) 18 cscript ospp.vbs /dstatus 19 pause >nul 20 Exit
2、office visio 2016/2019激活脚本
1 @echo off 2 title Activate Microsoft Visio 2019&cls&echo ============================================================================&echo #Visio: Activating Microsoft software products for FREE without software&echo ============================================================================&echo.&echo #Supported products:&echo - Microsoft Visio Standard 2019&echo - Microsoft Visio Professional Plus 2019&echo.&echo.&(if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16")&(if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16")&cscript //nologo ospp.vbs /inslic:"..\root\Licenses16\pkeyconfig-office.xrm-ms" >nul&(for /f %%x in (‘dir /b ..\root\Licenses16\client-issuance*.xrm-ms‘) do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&(for /f %%x in (‘dir /b ..\root\Licenses16\visioprovl_kms*.xrm-ms‘) do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&(for /f %%x in (‘dir /b ..\root\Licenses16\visiopro2019vl_kms*.xrm-ms‘) do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&echo.&echo ============================================================================&echo 正在尝试激活...&cscript //nologo ospp.vbs /unpkey:7VCBB >nul&cscript //nologo ospp.vbs /inpkey:9BGNQ-K37YR-RQHF2-38RQ3-7VCBB >nul&set i=1 3 :server 4 if %i%==1 set KMS_Sev=kms8.MSGuides.com 5 if %i%==2 set KMS_Sev=kms9.MSGuides.com 6 if %i%==3 set KMS_Sev=kms7.MSGuides.com 7 if %i%==4 goto notsupported 8 cscript //nologo ospp.vbs /sethst:%KMS_Sev% >nul&echo ============================================================================&echo.&echo. 9 cscript //nologo ospp.vbs /act | find /i "successful" && (echo 已完成,按任意键退出) || (echo 连接KMS服务器失败! 试图连接到另一个… & echo 请等待... & echo. & echo. & set /a i+=1 & goto server) 10 pause >nul 11 Exit
3、office project 2016/2019激活脚本
1 @echo off 2 title Activate Microsoft Project 2019 ALL versions for FREE!&cls&echo ============================================================================&echo #Project: Activating Microsoft software products for FREE without software&echo ============================================================================&echo.&echo #Supported products:&echo - Microsoft Project Standard 2019&echo - Microsoft Project Professional Plus 2019&echo.&echo.&(if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16")&(if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16")&cscript //nologo ospp.vbs /inslic:"..\root\Licenses16\pkeyconfig-office.xrm-ms" >nul&(for /f %%x in (‘dir /b ..\root\Licenses16\client-issuance*.xrm-ms‘) do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&(for /f %%x in (‘dir /b ..\root\Licenses16\projectprovl_kms*.xrm-ms‘) do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&(for /f %%x in (‘dir /b ..\root\Licenses16\projectpro2019vl_kms*.xrm-ms‘) do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&echo.&echo ============================================================================&echo 正在尝试激活...&cscript //nologo ospp.vbs /unpkey:PKD2B >nul&cscript //nologo ospp.vbs /inpkey:B4NPR-3FKK7-T2MBV-FRQ4W-PKD2B >nul&set i=1 3 :server 4 if %i%==1 set KMS_Sev=kms9.MSGuides.com 5 if %i%==2 set KMS_Sev=kms8.MSGuides.com 6 if %i%==3 set KMS_Sev=kms7.MSGuides.com 7 if %i%==4 goto notsupported 8 cscript //nologo ospp.vbs /sethst:%KMS_Sev% >nul&echo ============================================================================&echo.&echo. 9 cscript //nologo ospp.vbs /act | find /i "successful" && (echo 已完成,按任意键退出) || (echo 连接KMS服务器失败! 试图连接到另一个… & echo 请等待... & echo. & echo. & set /a i+=1 & goto server) 10 pause >nul 11 exit
六、Office 2019 下载地址(其它版本请上msdn.itellyou.cn)
office_professional_plus
office_visio_professional
office_project_professional
七、KMS密钥查询
Windows https://docs.microsoft.com/zh-cn/windows-server/get-started/kmsclientkeys
Office https://docs.microsoft.com/zh-cn/DeployOffice/vlactivation/gvlks
八、windows 活动目录通过配置批量许可激活服务,实现加入AD的计算机自动激活。