Create
Home › Forums › Microsoft Networking and Management Services › Active Directory › Create
- This topic has 4 replies, 3 voices, and was last updated 9 months, 2 weeks ago by
Russell Smith.
-
AuthorPosts
-
makavelli12MemberMar 11, 2020 at 7:05 am #626706Hi All,
Wonder if someone can help me here.
What I am basically trying to do is to create multiple user accounts from an existing user account, with the group membership, and settings of the account.
For example, the exiting user account is “TestUser1”, and is a member of the following groups: Domain Users, Workstation Users, Home Users
The account has the settings the password cannot be changed and the password does not expire.
As I have approx 30 User Accounts to create, I would like to use Powershell to do this for me.
Whilst I am a newbie Powershell scripter, I came across this script from the Manning website:
https://www.manning.com/books/learn-active-directory-management-in-a-month-of-lunches
$secpass = Read-Host “Password” -AsSecureString
$user = Get-ADUser -Identity jgreen -Properties memberof, office
New-ADUser -Name “GREEN Bill” -SamAccountName bgreen
-UserPrincipalName “[email protected]”
-AccountPassword $secpass -Path “cn=Users,dc=Manticore,dc=org”
-Enabled:$true -Instance $userand adapted it to my use for testing the creation of a single user account:
$secpass = Read-Host “Password” -AsSecureString
$user = Get-ADUser -Identity TestUser1 -Properties memberof
New-ADUser -Name “TestUser2” -SamAccountName testuser2
-UserPrincipalName “[email protected]”
-AccountPassword $secpass -Path “cn=Users,dc=localtest,dc=net”
-Enabled:$true -Instance $userWhen I try the script the account is created, but it does not assign the group memberships and the display name is also missing. So am working if someone with expert knowledge could advise me how I can do the following:
1. Get the group membership working
2. Set the Displayname to be testuser2
3. Set the password cannot be changed
4. Set the password does not expireIf there is a way to do this for the 30 user accounts via a CSV file this would be even better.
Hope this makes sense, and someone can advise.
Thanks.
Mak
-
AuthorPosts
You must be logged in to reply to this topic.