Skip to content

Adding user to localgroup in task sequence

Featured Replies

during OSD from SCCM When creating a new machine I wanna create a local user called 'ITadmin' And add that to the Administrators group

The following commands, I add as 'command lines' to my task sequence

1: net user /add ITadmin SecretCode123
2: wmic useraccount where "Name='ITadmin'" set PasswordExpires=false

these work, the ITadmin user is created and the password is set to never expire

 

 

3: net localgroup "Administratorer" "ITadmin" /add

this third one does however not work. The group is called 'Administratorer' which is the danish version of 'Administrators' (I tried both)

 

The line I pasted here works when I do it manually in an elevated cmd. it correctly adds ITadmin to the "Administratorer" group.So the command is correct

So why doesn't it work during the task sequence? Could it be its because it requires Admin rights to do? how would I force it to attempt 'elevated' ?

  • 1 year later...

I have exactly the same problem! The command works in an elevated prompt but doesn't inside a task sequence (it returns error code 0 though).

You could try putting the commands into a notepad file and saving it as "Install.cmd", then turning that into a Package, with the folder containing Install.cmd as the source folder.

Then create a Standard Program in that package, specifying Install.cmd as the command line, and you can then configure that the Program can run whether a user is logged on or not, which will also put the Run mode to "Run with administrative rights".

 

Then just install the package as part of your task sequence at the point you were putting the command line entries.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.