This script does an activation against an internal kms-server hosted on a client-installation of windows 7 and higher and server-installation. The advantage is the fact, that you don't need to modify your dns server to serve special records to all clients, maybe also the “unwanted” clients. If u don't use an emailscript to get notified about errors please comment out the section in the error-handler.
; kms-activation
; ----------------------------------------------------------------
[Actions]
requiredWinstVersion >= "4.11.2.6"
; Variablendefinition
; ----------------------------------------------------------------
; statisch, nicht verändern
DefVar $errorcode$
DefVar $logdir$
DefVar $productid$
DefVar $minimumspace$
; variabel, frei veränderbar
; Variablenzuweisung
; ----------------------------------------------------------------
; statisch, nur den Gegebenheiten anpassen
Set $logdir$ = "%SystemDrive%\tmp"
Set $productid$ = "kms-activation"
Set $minimumspace$ = "30 MB"
; teilstatisch, nur den Gegebenheiten anpassen
; Skriptbeginn
; ----------------------------------------------------------------
; Prüfung auf freien Speicher
; ----------------------------------------------------------------
if not(Hasminimumspace ("%SystemDrive%", $minimumspace$))
LogError "Nicht genuegend freier Speicher auf %SystemDrive%, " + $minimumspace$ + " auf dem Speicher %SystemDrive% werden für " + $productid$ + " benoetigt!"
isFatalError "Kein Speicher"
; Ablauf stoppen und Installationsstatus auf fehlerhaft setzen.
endif
; Eigene Prozedurenaufrufe und Ablaufplanung
; ----------------------------------------------------------------
; variabel, frei veränderbar
Sub_preactions
Sub_activation
Sub_postactions
; Skriptende
; Subprozeduren
; ----------------------------------------------------------------
; Installationsopener - statisch, nicht verändern
[Sub_preactions]
ShowBitmap "%ScriptPath%\resources\logo.png" $productid$
Message "Installation von " + $productid$ + " wird ueberprueft..."
; variabel, frei veränderbar
[Sub_activation]
Message "Die Aktivierung wird durchgefuehrt..."
DosInAnIcon_activate
Sub_errorhandler
[Sub_postactions]
Message "Das System wird neu gestartet..."
ExitWindows /Reboot
; Fehlerbehandlungsroutine - statisch, nicht verändern
[Sub_errorhandler]
Set $errorcode$ = getLastExitCode
if ($errorcode$ = "0")
Message "Aktion war erfolgreich!"
else
Message "Aktion schlug mit Errorcode " + $errorcode$ + " fehl!"
Sub "%ScriptPath%\..\mail-send\error_notification.ins"
isFatalError
endif
; Sektionen - variabel, frei veränderbar
; ----------------------------------------------------------------
[DosInAnIcon_activate]
REM KMS-Clientkey wird gesetzt...
"cscript.exe" "slmgr.vbs" /ipk FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4
REM KMS-Server wird gesetzt...
"cscript.exe" "slmgr.vbs" /skms kms.deinefirma.org:1688
REM KMS-Aktivierungsanfrage wird gesendet...
"cscript.exe" "slmgr.vbs" /ato