Script help please!
I am looking for some help in creating a script that will add multiple accounts with passwords for Windows 7. I did some research (first day of class, no book assigned) and I cannot seem to make sense of it. It can be in any language as long as it does the said functions. Does anyone know of some free resources that could help me build such a simple script? Or possibly share one and break down what each part means? If so, it would be greatly appreciated.
Comments
-
TheFORCE Member Posts: 2,297 ■■■■■■■■□□I don't beleive people here would go ahead and do your homework for you. That's not what this forum is for. But we can guide you to the right direction.
Do some searches in the intrawebs for Powershell. It will help you do what you want very easily. There's tons of free resources on the Microsoft website that explain all the switches and how to use them. -
Swaswaswa Member Posts: 45 ■■□□□□□□□□I don't beleive people here would go ahead and do your homework for you. That's not what this forum is for. But we can guide you to the right direction.
Do some searches in the intrawebs for Powershell. It will help you do what you want very easily. There's tons of free resources on the Microsoft website that explain all the switches and how to use them.
Thank you so much. I will try and learn Powershell! Well, I'm gonna have to anyways. lol -
knownhero Member Posts: 450NET USER username "Passw0rd"/ADD
NET LOCALGROUP "groupName" "userName" /ADD
#Array of users names you want to have added $arryUsers = @("user1", "user2", "user3", "user4") $password = "password" $group = "Users" foreach ($u in $arryUsers) { NET USER $U $password /ADD NET LOCALGROUP $group $u /ADD }
The code is basically writing this for you countless times to make the accounts:
ALSO: Make sure your password requirements meet any policies you have on the machine otherwise you'll get this:
The password does not meet the password policy requirements. Check the minimum password length, pas
sword complexity and password history requirements.
This is a very simple script that just creates the users for you. You don't get the options to make many changes when it comes to domain accounts. But you mention windows 7 on your post so this will get you started.70-410 [x] 70-411 [x] 70-462[x] 70-331[x] 70-332[x]
MCSE - SharePoint 2013 :thumbup:
Road map 2017: JavaScript and modern web development -
Verities Member Posts: 1,162Thank you so much. I will try and learn Powershell! Well, I'm gonna have to anyways. lol
A really good blog for Powershell is:
Hey, Scripting Guy! Blog - Site Home - TechNet Blogs
He answers questions about scripts, I believe you can post yours for him to review and he has a good size repo of previously created scripts that can you can download and use or look at to see how Powershell works:
https://gallery.technet.microsoft.com/scriptcenter -
Claymoore Member Posts: 1,637Here is a command to create a single user from a script I had that creates a service account. You could run this multiple times in a script or import a CSV file and create a list of accounts.
Import-Module activedirectory new-aduser -Name User -UserPrincipalName User@corp.domain.com -AccountPassword (ConvertTo-SecureString "P@ssword" -AsPlainText -Force) -Enabled $true -PasswordNeverExpires $true
You can include just about every account attribute in the New-ADUser command:
https://technet.microsoft.com/en-us/library/ee617253.aspx -
knownhero Member Posts: 450@Claymoore
You've posted AD code. The OP asked for Windows 7. But to extend on your PS you can simply put that in a foreach loop.70-410 [x] 70-411 [x] 70-462[x] 70-331[x] 70-332[x]
MCSE - SharePoint 2013 :thumbup:
Road map 2017: JavaScript and modern web development -
philz1982 Member Posts: 978I will send you some links to help you but first you need to tell us. I assume you want to use powershell or are you looking for some other form of scripts.
Next I need to know is this local or AD accounts?
Building PS Scripts is really simple and tons of resources.
My only coaching to you is get very comfortable with MSDN, StackExchange, and ServerFault. Also, learn to use the ISE version of Powershell (Makes life a lot easier!).
Feel free to pm me with questions. While I won't write the script for you, I will give you coaching on resources and processes. Also, go buy the books 30 lunches Powershell and 30 Lunches Powershell advanced (I think those are the names). The authors make a boring subject like Powershell interesting.Read my blog @ www.buildingautomationmonthly.com
Connect with me on LinkedIn @ https://www.linkedin.com/in/phillipzito -
Swaswaswa Member Posts: 45 ■■□□□□□□□□Thank you all for taking your time and helping me! I will use every resource provided.I will send you some links to help you but first you need to tell us. I assume you want to use powershell or are you looking for some other form of scripts.
Next I need to know is this local or AD accounts?
Building PS Scripts is really simple and tons of resources.
My only coaching to you is get very comfortable with MSDN, StackExchange, and ServerFault. Also, learn to use the ISE version of Powershell (Makes life a lot easier!).
Feel free to pm me with questions. While I won't write the script for you, I will give you coaching on resources and processes. Also, go buy the books 30 lunches Powershell and 30 Lunches Powershell advanced (I think those are the names). The authors make a boring subject like Powershell interesting.
They're local accounts, I have to execute the script in a VM Windows 7 environment. I will PM you with any questions. Thanks again everyone, very helpful. Great community here.