/build/static/layout/Breadcrumb_cap_w.png

Windows 10 - Post Installation Tasks won't run

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   [ + ] Show comments
  • The K2000 should turn off UAC before running the post installation tasks. What do the tasks look like on the K2000? - chucksteel 7 years ago
    • Hi @chuckstell , Thanks for replying. When you say what the tasks look like, what do you want me to display to you? - Myth0S 7 years ago
      • The configuration for the task on the K2000. Is it setup as an application, script, etc.? What are the parameters. - chucksteel 7 years ago
  • I replied below, please note that no middle tasks are being used. - Myth0S 7 years ago

Answers (2)

Posted by: Myth0S 7 years ago
Yellow Belt
0
#NoTrayIcon 
#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
Return

GuiClose:
ExitApp

ComputerNumber:
GuiSubmitnohide
return

ComputerName:
GuiSubmitnohide
return

Username:
GuiSubmitnohide
return

ComputerDescription:
GuiSubmitnohide
return

ComputerDomain:
GuiSubmitnohide
return

ButtonChangeComputerDescription:
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
}
Else
Msgbox, Fail - Check the network connection or if Admin account is locked
return


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

Param(
  [string]$AdminAccount,
  [string]$Description,
  [string]$NewName
)

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

$OSWMI=Get-WmiObject -class Win32_OperatingSystem
$OSWMI.Description=$Description
$OSWMI.put()
Add-Computer -DomainName XXXXXXXX -NewName $NewName -Options JoinWithNewName,AccountCreate -Credential $AdminAccount

aAMse0P.png
8hAqrm.png

Comments:
  • What is jointoDomain.exe? Is that an executable that calls the PowerShell script? - chucksteel 7 years ago
    • Yes it's the executable of the AHK Script. - Myth0S 7 years ago
  • 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:
    http://www.itninja.com/blog/view/get-set-computername

    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. - chucksteel 7 years ago
    • I could try to do that but will they run fine or will they need elevation as well? - Myth0S 7 years ago
      • 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. - chucksteel 7 years ago
Posted by: Myth0S 7 years ago
Yellow Belt
0
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?

Comments:
  • 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. - chucksteel 7 years ago
    • I can see a Restore UAC post install task but not a Disable UAC task or anything related to that. Should there be one? - Myth0S 7 years ago
      • Yes, it should be after the Set Engine Run Key task. It is named Capture and Disable UAC. - chucksteel 7 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ