Jump to content

Recommended Posts

Posted

Is it possible to add a local user during a PXE booted Task Sequence in SCCM/MECM when the computer is in a Workgroup?

 

People seem to be suggesting you simply add the command net user /add in a command line within the task sequence - it sounds like they are just guessing as the command can only be run in an elevated command prompt and during the task sequence the commands are not elevated.

 

Screenshot 2021-05-05 142557.png

 

 

Has anyone successfully added a local user to a computer during a task sequence? If so could you share a screenshot of what you did to achieve this?

Posted

We do ours in a powershell script (which also does other things at the same time), and our code is:

 

net.exe user /add "UserName" "Password" /fullname:"UserName" /comment:"IT Services Admin Account"
net.exe localgroup administrators UserName /add
WMIC USERACCOUNT WHERE "Name='UserName'" SET PasswordExpires=FALSE

 

this creates the local admin account that we use, and sets a default password (until LAPS kicks in once the machine is built and up and running and sets a new password for it).

Posted
Yes, here you are[ATTACH=CONFIG]61711[/ATTACH]

 

Thanks for the quick reply! :) Unfortunately that hasn't worked for us. No idea why not, the user is just not being created for some reason.

Posted
Make sure you have the command in the right place in the task sequence - in the image you showed, it was running too soon. Put it just before your bitlocker command.
  • Thanks 1
Posted
Make sure you have the command in the right place in the task sequence - in the image you showed, it was running too soon. Put it just before your bitlocker command.

 

Thanks - I've moved it and trying again now :)

 

I've not touched SCCM/MECM for around 2 years so I'm trying to remember everything I've forgot!

Posted

The user is still not being created - I'm clearly having a 'moment' so can you spot what I'm doing wrong?

 

Screenshot 2021-05-06 101319.png

 

As a test I'm trying to create an account called Student with a password of student using the command as detailed previously in this thread but for whatever reason it's not creating the account so I'm clearly doing something (so simple) incorrectly somehow!

Posted
What do you have in your "Apply Network Settings" section? Do you use a sysprep when applying the OS - could a setting in there cause a problem? In "Apply Windows Settings" I enable the local administrator account and set a password, if you do that you will at least be able to log ontot he machine once built and see what's happening with the user account.
Posted (edited)

I never put in the cmd.exe bit for my command lines, just the command I want to run.

 

Try this as powershell.

 

$Account = "Student"
$Password = "Student"

cmd /c "net user $Account $Password /add /comment:""Student"" "

cmd /c "WMIC USERACCOUNT WHERE ""Name='$Account'"" SET PasswordExpires=FALSE"

Edited by Driftingforlife
Posted
What do you have in your "Apply Network Settings" section? Do you use a sysprep when applying the OS - could a setting in there cause a problem? In "Apply Windows Settings" I enable the local administrator account and set a password, if you do that you will at least be able to log ontot he machine once built and see what's happening with the user account.

 

I've just checked and oddly enough that doesn't work either! Despite it being set, the local Administrator account is disabled so somethings not right!

 

Screenshot 2021-05-06 122652.png

 

After creating the software build I use the Manual Capture from SCCM/MECM which uses SysPrep to prepare the image for deployment etc.

Posted

ALL SORTED NOW!

 

As the last version of Windows 10 I used to create a Golden Image was 1909 and we're not on 20h2.6 I decided to create a new Task Sequence from scratch (as opposed to copying an old one and editing the relevant parts) and even though every single step has exactly the same settings (some I even copied and pasted) from the old task sequences it just didnt work as it should from not setting the local administrator account up correctly to it not running the new command I added from this thread to add a local user account.

 

I tried creating another TS from scratch and that also didnt work properly. I then went back to my old way of doing things and copied/duplicated a TS, edited that with the new settings and pointed it to my new 20h2.6 Golden Image file I used previously and that worked!

 

Very strange.

Posted
Yes, here you are[ATTACH=CONFIG]61711[/ATTACH]

 

Slightly off-topic but I see you activate office within your Task Sequence - I've installed Office 2019 for the first time and when I log on to the newly imaged laptop, Office 2019 isnt Activated so could you share what command(s) you're running to activate office as I've tried one and it's not activating it?

 

Thanks.

Posted

Activate office 1:

cmd /c C:\windows\system32\cscript.exe "C:\Program Files\Microsoft Office\Office16\OSPP.VBS" /inpkey:

Activate Office 2:

cmd /c C:\windows\system32\cscript.exe "C:\Program Files\Microsoft Office\Office16\ospp.vbs" /act

  • Thanks 1
  • 2 months later...
Posted

I'm having pretty much the same issue. I've tried nearly every possible way to create this user. This is building a fresh 20H2 Win 10 machine via MECM PXE, non-domain. Even though I have a admin password set in the process, it still disables the account and fails to create the account. I've tried doing straight command line like here, I've tried creating a package and has batch and PowerShell scripts then running those scripts in a SMSTSPostAction, all fail. Machine reboots in to windows, and sits at the login screen with all users disabled. Any help would be appreciated.

RCL.JPGfail.JPG

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...