Jump to content


P3nnyw1se

Adding user to localgroup in task sequence

Recommended Posts

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' ?

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.