Solved

script, batch file, windows 7, username create script

Posted on 2014-03-05
6
6,465 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 35

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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 500 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 35

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

Are your corporate email signatures appalling?

Is it scary how unprofessional your email signatures look? Do users create their own terrible designs and give themselves stupid job titles? You can make this a lot easier for yourself by choosing an email signature management solution from Exclaimer today.

Join & Write a Comment

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now