Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

script, batch file, windows 7, username create script

Posted on 2014-03-05
6
Medium Priority
?
7,055 Views
Last Modified: 2014-03-13
Hi experts,

looking for your help....

we have some deployment happening this month, the below users need to be created for all client pc..not domain environment.

Need to create the below user accounts after installing the win 7, can you please help me is it possible to create users running batch file ?



Username 1 :abunlock
Password : Bact!qaz
Group : Users
User cannot change password.
Password Never Expire

Username 2 :auser
Password : Bact!qaz
Group : Users
User cannot change password.
User Must Change password at next logon

Username 1 :abce
Password : Bact!qaz
Group : Administrators
User cannot change password.
Password Never Expire
0
Comment
Question by:Skumar_CCSA
6 Comments
 
LVL 10

Expert Comment

by:Korbus
ID: 39908445
0
 
LVL 38

Expert Comment

by:Mahesh
ID: 39908637
The best option I can see to fulfill your requirement is to use GP preferences

Create brand new GPO and navigate to computer configuration\preferences and navigate to users
There you can create new local users in update mode with required password and remaining password and also you can set their group membership as well

Once you have done, apply this policy on OU containing computers
During next reboot \ GPO update interval new users will be created on client computers
Once it get created next time policy will check if user already exists, then it will skip their recreation.
If some body deletes them, policy will recreate them

Check below link for more information
http://technet.microsoft.com/en-us/library/cc771917.aspx 

Check below link for step by step
http://blog.korteksolutions.com/how-to-create-local-accounts-via-group-policy/

Also if computer configuration is not working then move the settings to the User section of preferences instead of Computer, then enabled group policy loopback processing to apply it to the computer.
Loop back processing can be found under computer configuration\administrative templates\system\group policy in the same GPO

Mahesh
0
 
LVL 10

Expert Comment

by:Korbus
ID: 39908689
Mahesh,
Don't you need a domain and windows server to use group policy?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Skumar_CCSA
ID: 39908763
No domain enviornment...
This need to be done through script....
After installing window 7..admin  will run the script and it  will creAte users .
0
 
LVL 10

Accepted Solution

by:
Pramod Ubhe earned 2000 total points
ID: 39908968
Method 1 - run a powershell script for multiple computers

Get-Content c:\servers.txt | foreach {
#Create the account
$username = "user1"
$comp = [adsi] "WinNT://$_"
$user = $comp.Create("User", $username)
$user.SetPassword("P@ssw0rd")
$user.SetInfo()
#Set password to never expire
$ADS_UF_DONT_EXPIRE_PASSWD = 0x10000
$user.userflags = $ADS_UF_DONT_EXPIRE_PASSWD
$user.SetInfo()
#Add the account to the local admins group
$group = [ADSI]"WinNT://$_/Administrators,group"
$group.add("WinNT://$_/$username")
}

Method 2 - create batch file with below commands
net user user1 Passw0rd1 /add /passwordchg:no
net localgroup Administrators user1 /add
wmic.exe UserAccount Where Name="user1" Set PasswordExpires=FALSE

Method 3 - create a vb script with below commands
strComputer = "atl-ws-01"
Set colAccounts = GetObject("WinNT://" & strComputer & "")
Set objUser = colAccounts.Create("user", "Admin2")
objUser.SetPassword "09iu%4et"
objUser.SetInfo


***remember to modify these commands for your requirement and test them on test computer/environment, i have also included commands to add accounts in admin group but you can remove it if required.
0
 
LVL 38

Expert Comment

by:Mahesh
ID: 39925857
Ya, Korbus,

You are right

GPO won't work

I think I have over looked question
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question