Scripting Question

K2000 Postinstall Powershell with credentials

11/19/2019 614 views

Hi all,

I would like to know if it is possible to create a post installation powershell script and run it with credentials.

The k1000 is capable of this and it would be great to do this right after a system image deployment.

Kind regards,


0 Comments   [ + ] Show comments


Community Chosen Answer



You can write passwords in Powershell as a secure string to a file and reuse later.

If you upload the file to KACE SDA and call it in your Powershell script, you always have your Crendentials with you.

Create Secure String in cred.txt

PS C:\> read-host -assecurestring | convertfrom-securestring | out-file C:\cred.txt

Get it back to a password

PS C:\> $password = get-content C:\cred.txt | convertto-securestring

Create a credential object, which you can use in cmdlets

PS C:\> $credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist "myusername",$password

Answered 11/19/2019 by: Gerhart
Green Belt

  • We have tried this but when the script is executed during OSD we get the error that the domain (name) is not available.

    We execute the script after the domainjoin.vbs script.
    • Are you running a reboot after the domainjoin.vbs script? Otherwise, the domain join may not be complete.
      • Reboot required is indeed enabled for this task.
    • Did the name resolution works in the OSD? Maybe it´s a DNS problem. Check if ping to Domain FQDN and Netbios in OSD are work properly.
      • When I am in the KBE before selecting an image, I select recovery and start Command Prompt. In this Command Prompt I cannot ping our domain, but I can ping a Domain Controller. Should this be sufficient?
    • The command line after booting the KBE is not helpful to test it.

      You have to create a post-installation task that runs on an error. Then insert this task after the domain join task. The scripted installation must be set to stop at error. In the window that comes up, a command line can be opened. There you can try to ping the domain controller.

      sorry, it's not easy to explain. Tomorrow i'll try to make some screenshots.
      • Thanks for the explanation. I know how to test this so will do so right now.

All Answers


I have resolved the issue by placing the post installation task directly after the join domain powershell script.

Everything works as intended now.

Answered 11/22/2019 by: Loei
Orange Belt

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