KMS 搭建

建议在局域网搭建和使用,不建议放在公网 VPS,会被微软投诉导致 VPS 服务商关闭 VPS

打包 Docker 镜像

Dockerfile

FROM alpine:latest as builder

WORKDIR /tmp

RUN apk add --no-cache git make build-base && \
    git clone --branch master --single-branch https://github.com/Wind4/vlmcsd.git && \
    cd vlmcsd/ && \
    make

FROM alpine:latest

WORKDIR /tmp

COPY --from=builder /tmp/vlmcsd/bin/vlmcsd /usr/bin/vlmcsd

EXPOSE 1688/tcp

CMD [ "/usr/bin/vlmcsd", "-D", "-d" ]

打包脚本 build.sh

#!/bin/bash

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

docker buildx build --no-cache --platform linux/amd64,linux/arm64 -f Dockerfile -t liwei19920307/vlmcsd:latest . --push

打包命令

chmod a+x ./build.sh && ./build.sh

Docker

  • docker-compose.yml

    services:
      vlmcsd:
        image: liwei19920307/vlmcsd:latest
        container_name: vlmcsd
        volumes:
          - /etc/localtime:/etc/localtime
        environment:
          - TZ=Asia/Shanghai
        network_mode: host
        restart: always
    

激活

激活 Office2019 专业版

保存下面代码为 bat 后缀文件,修改代码内 ip 为 docker 的 ip

@echo off

(cd /d "%~dp0")&&(NET FILE||(powershell start-process -FilePath '%0' -verb runas)&&(exit /B)) >NUL 2>&1

title Office 2019 Activator r/Piracy

echo Converting... & mode 40,25

(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)

cscript //nologo ospp.vbs /unpkey:6MWKP >nul&cscript //nologo ospp.vbs /inpkey:NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP >nul&set i=1

:server

if %i%==1 set KMS_Sev=192.168.2.12

if %i%==2 set KMS_Sev=192.168.2.12

if %i%==3 set KMS_Sev=192.168.2.12

cscript //nologo ospp.vbs /sethst:%KMS_Sev% >nul

echo %KMS_Sev% & echo Activating...

cscript //nologo ospp.vbs /act | find /i "successful" && (echo Complete) || (echo Trying another KMS Server & set /a i+=1 & goto server)

pause >nul

exit

激活 Win10 专业版

保存下面代码为 bat 后缀文件,修改代码内 ip 为 docker 的 ip

slmgr /upk

slmgr /ipk W269N-WFGWX-YVC9B-4J6C9-T83GX

slmgr /skms 192.168.2.12

slmgr /ato

slmgr /xpr

slmgr /dlv

exit