K2000 Postinstall Powershell with credentials
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,
Loei
Answers (2)
Hi
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
Comments:
-
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. - Loei 5 years ago-
Are you running a reboot after the domainjoin.vbs script? Otherwise, the domain join may not be complete. - Gerhart 5 years ago
-
Reboot required is indeed enabled for this task. - Loei 5 years ago
-
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. - Gerhart 5 years ago
-
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? - Loei 5 years ago
-
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. - Gerhart 5 years ago-
Thanks for the explanation. I know how to test this so will do so right now. - Loei 5 years ago