Hi All,

I have two post installation Tasks for Windows 10.

1) Windows 10 Activation
2) Compute Rename, Computer Description Change and Add to Domain

First of all, the scripts won't run except If I elevate them to run as admin via a bridge script and again in order for the Powershell script to run there is a pop up that I need to click yes to allow the Powershell script to run.

For Windows 10 Activation we are using MAK Keys. In order to Activate the copy of Windows, I am using slmgr.vbs -IPK command and slmgr.vbs -ATO command and although the ato command states that the Windows copy has been activated it when you login windows are not activated. 

For the joining domain part although the join to domain part succeeds it doesn't rename the computer and instead it creates a randomly generated name.

In order to join it to the domain, I am using the command below

Add-Computer -DomainName XXXXXXXXX -NewName $NewName -Options JoinWithNewName,AccountCreate -Credential $AdminAccount

So eventually I would like for the scripts to run without any pop ups and failures. I thought maybe disabling UAC would help but on my tests even as an admin trying to run these scripts fail and they need elevation, which I don't really understand why.
2 Comments   [ - ] Hide Comments


  • The K2000 should turn off UAC before running the post installation tasks. What do the tasks look like on the K2000?
    • Hi @chuckstell , Thanks for replying. When you say what the tasks look like, what do you want me to display to you?
      • The configuration for the task on the K2000. Is it setup as an application, script, etc.? What are the parameters.
  • I replied below, please note that no middle tasks are being used.
Please log in to comment

Answer this question or Comment on this question for clarity


#SingleInstance force
GuiAddText, x12 y5 w200 h20 ,Select Country Naming Convention:
GuiAddDropDownList, x12 y20 w190 h120 vcompName gComputerName, XXXX-|YYYY-|ZZZZ-
GuiAddEdit, x12 y45 w100 h20 vcompNumber gComputerNumber Number Limit5
GuiAddText, x12 y80 w150 h20 ,Select Admin Username:
GuiAddDropDownList, x12 y95 w190 h120 vusername gUsername, DOMAINXX\AdminAcc1|DOMAINXX\AdminAcc2 |DOMAINXX\AdminAcc3
GuiAddText, x12 y130 w150 h20 ,Select Computer Description:
GuiAddDropDownList, x12 y145 w190 h120 vcompDesc gComputerDescription, Head Office|Operations|Quality|R&D|Sales & Marketing|Malaysia|China
GuiAddButton, x12 y190 w150 h50 , ChangeComputerDescription
GuiShow, x12 y120 h250 w250, Add PC to Domain







Runwait *RunAs PowerShell.exe -ExecutionPolicy Bypass -File C:\KACE\Applications\47\joinToDomain.ps1 -AdminAccount %username% -ComputerDescription "%compDesc%" -NewName "%compName%%compNumber%"
Runwait powershell.exe -WindowStyle Hidden (Get-WmiObject -Class Win32_ComputerSystem).PartOfDomain | clip
domain_status = %clipboard%
TrueA = True
IfInString, domain_status, %TrueA%
Msgbox, Success - Computer Added to the domain
Run cmd.exe /c SystemPropertiesComputerName
Msgbox, Fail - Check the network connection or if Admin account is locked

So this ahk script calls joinToDomain PowerShell script which is the one below:


Write-Host $AdminAccount
Write-Host $NewName
Write-Host $Description

$OSWMI=Get-WmiObject -class Win32_OperatingSystem
Add-Computer -DomainName XXXXXXXX -NewName $NewName -Options JoinWithNewName,AccountCreate -Credential $AdminAccount

Answered 04/03/2017 by: Myth0S
Yellow Belt

  • What is jointoDomain.exe? Is that an executable that calls the PowerShell script?
    • Yes it's the executable of the AHK Script.
  • Rather than have one script that does all of these things, have you considered using the supported tools for each step?

    For instance, you can just run the activation command using cscript:
    cscript //b c:\windows\system32\slmgr.vbs /ipk <MAK Number>
    cscript //b c:\windows\system32\slmgr.vbs /ato

    Then set the name using Get/Set Computer Name:

    There should also be an example post install task for joining to the domain. My guess is that AHK is part of the issue here.
    • I could try to do that but will they run fine or will they need elevation as well?
      • With UAC disabled they do not require elevation. Also, since you didn't say either way, are you using the built-in administrator account or another account? Microsoft no longer recommends using the built-in account so you should create a new one, that might also be an issue.
Please log in to comment
We are using another account which is an administrator. I will try your suggestions, thanks.

"With UAC disabled they do not require elevation" when you say that could you expand a little bit more and include more information. Does K2000 disables the UAC itself or do I need to change it?
Answered 04/03/2017 by: Myth0S
Yellow Belt

  • The K2000 should disable it before running any tasks. After imaging when the computer auto logs into Windows and the KACEEngine starts it should be listed as one of the tasks on the left.
    • I can see a Restore UAC post install task but not a Disable UAC task or anything related to that. Should there be one?
      • Yes, it should be after the Set Engine Run Key task. It is named Capture and Disable UAC.
Please log in to comment