Solved

script, batch file, windows 7, username create script

Posted on 2014-03-05
6
6,775 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 10

Expert Comment

by:Korbus
ID: 39908445
0
 
LVL 37

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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

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 37

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

697 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