SCCM – Add Local User to Administrators Group During OSD

sccm logo

Table of Contents

Last updated on March 30th, 2023 at 06:04 pm

Read Time:1 Minute, 17 Second

You may have seen our previous post about adding a local user to a machine during SCCM OSD using a “Run Command Line”. Well in this guide we will show you how to add a local user into the Administrators Group on the local machine. This means that you can add a local user and then make them a local administrator all within the SCCM OSD task sequence.

Instructions

You will need to add a “Run Command Line” step towards the end of your task sequence ensuring it is after the Windows deployment and the ConfigMgr Client installation.

Then, you should use the following command:

cmd.exe /c net localgroup "Administrators" "LocalAdmin" /add

The details for what each part of this command line mean are below:

  • cmd.exe /c – required to run a successful command
  • net localgroup – command line to make amendments to local groups
  • “Administrators” – the name of the local administrators group
  • “LocalAdmin” – the name of your local user account
  • /add – to add the stated user to the stated localgroup

When you have finished, your step should look something like this:

2

Now, when you run through your task sequence, this will run the command line and add your stated user to the local administrators group.

If you want to run this with also creating a new local user, ensure that you have this step after the create local user step or it will fail.

Comments

If you have any questions about this guide, please feel free to leave us a message below using our comments system.

Click to rate this post!
[Total: 1 Average: 5]

19 thoughts on “SCCM – Add Local User to Administrators Group During OSD

  1. Good morning, First off I’d like to thank you this wonderful guide. I’ve integrated this into my SCCM a couple of different ways but am having issues. I first created two .bat files and add them into SCCM as packages. I did individual ones and one that has both commands added and causes the user script to run first so the account is created and then the admin script runs to give the created user admin rights. I have successfully run these.bat files on machines and they work flawlessly. I’ve tried both these scenarios in SCCM during OSD. When I use the individual .bat packages, the user profile gets created but it doesn’t get admin rights. When I use the combo ( both command lines run back to back ) it doesn’t even create the user. Lastly, I tried just adding the cmd lines into the task sequence. Again, the user gets created but its not getting the admin rights. Any thoughts would be appreciated. Thanks and have a great day.

  2. 0x00000002 – add your task most latest, after “Setup Windows and Configuration Manager”

  3. Hello,

    I’m trying to create a user and adding it to administrator group during OSD but it fails with an 0x00000002 error code.

    can u help me plz ?

  4. Hi,

    How can I add an AD security Group into local administrator group as part of OSD task sequence using SCCM 2012 R2?

    Please help..

    thanks

  5. How can i set the local user just created as a autologon user? (as part of OSD task sequence using SCCM 2012 R2)

  6. I do the second task of add as administrator and I get an error.

    Error – Event ID – 10016

  7. I do the second task of add as administrator and I get an error.

    Error – Event ID – 10016

  8. How can i set the local user just created as a autologon user? (as part of OSD task sequence using SCCM 2012 R2)

  9. Hello,

    I’m trying to create a user and adding it to administrator group during OSD but it fails with an 0x00000002 error code.

    can u help me plz ?

  10. Hi,

    How can I add an AD security Group into local administrator group as part of OSD task sequence using SCCM 2012 R2?

    Please help..

    thanks

Leave us a message...

This site uses Akismet to reduce spam. Learn how your comment data is processed.