/build/static/layout/Breadcrumb_cap_w.png

Removing local Administrator Account after Imageinstallation

Hello ITNinja Community,


we are using the K2000 and a Scripted Installation to perform our windows imageinstallations. The Scripted Installation uses a local admin account which gets created during the image installation. We would like to remove this local account after the installation is finished. For that I created a Powershell script and a corresponding post installation task. The powershell script logs out all users and removes the administrator account. The problem is, that the scripted installation wont get finished after running the script. It seems like the local admin account is required in order to complete the installation. Is there any way to complete the installation upon removing the account?


Thanks in advance


0 Comments   [ + ] Show comments

Answers (3)

Answer Summary:
Posted by: FelixF 2 months ago
White Belt
1

Top Answer

 solved this issue by creating a scheduled task during a post installation task. This scheduled task runs at the next reboot and deletes the user. The scheduled task gets deleted after it ran.

Posted by: Nico_K 2 months ago
Red Belt
0

The full cleanout is done by this account so it is not possible to remove it while the deployment.
Keep in mind, that all Post Install Tasks are running with the freshly installed OS, so do not do this in a Mid Level Task!
You can set as last task a task which copies a batch file which deletes the user and the user folder to the system and a task which sets HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce to run this file. Then it will run first time the system boots up after deoloyment and clean out.


Comments:
  • Hello Nico, for your information. I solved this issue by creating a scheduled task during a post installation task. This scheduled task runs at the next reboot and deletes the user. The scheduled task gets deleted after it ran.
    Your suggestion wouldnt have worked because that registry key only takes affect after an administrator account is logged in. - FelixF 2 months ago
Posted by: FelixF 2 months ago
White Belt
0
Hello Nico, thanks for your suggestion. The RunOnce Command will only be executed after an administrator login. I understand, that the user is required in order to complete the image installation. Is there any other way, to run the script after the installation? I thought maybe a managed installation which is applied to a smart label which contains all new installed devices. But this wouldnt get devices, which get powered off right after installation
 
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