Monday, December 26, 2011

Auto KMS schedule fix

Fix for Auto KMS (EZ-Activator / Microsoft Toolkit) schedule (it wants to run at every reboot + every day, while required only once per 180 days, so we changing it to run once per month).

Place these files at AutoKMS folder and run AutoKMS.bat by hands (from admin account) once.


AutoKMS.bat
c:
cd c:\windows\AutoKms
start /WAIT AutoKMS.exe
c:
cd c:\windows\AutoKms
powershell -command "Set-ExecutionPolicy RemoteSigned"
powershell -file autokms.ps1 > autokms.schedulelog
powershell -command "Set-ExecutionPolicy AllSigned"

AutoKMS.ps1
$n = "AutoKMS"
$s = new-object -com("Schedule.Service")
$s.connect()
$f = $s.getfolder("\")
$t = $f.gettask($n)
$d = $t.Definition
$r = $d.Triggers.Item(1)
$r.DaysInterval = 30
$r = $d.Triggers.Item(2)
$r.Enabled = $false
$a = $d.Actions.Item(1)
$a.Path= $a.Path.replace(".exe", ".bat")
$f.RegisterTaskDefinition($n, $d, 0x24, $null, $null, 5, $null)

2 comments:

  1. I have AutoKMS in c:\Windows\AutoKms\AutoKms.exe
    So I think your solution will not work. Can I just change the dir setting in the .bat file and run it?

    ReplyDelete
  2. If you have Windows 8, task scheduler is where you'll need to go to make autokms run on the schedule you want, instead of on every boot.

    ReplyDelete