• Like

Windows power shell and active directory

Uploaded on

Quick over view of windows powershell and active directory, runs though some of the common and often used command sets

Quick over view of windows powershell and active directory, runs though some of the common and often used command sets

More in: Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide
  • http://asdirkseesit.blogspot.com/2012/10/powershell-bulk-adding-users-active.html
  • http://asdirkseesit.blogspot.com/2012/10/powershell-bulk-adding-users-active.html


  • 1. CIS 216Highline Community CollegeDan Morrill
  • 2.  Windows Server 2008 R2 Active Directory running and configured Windows Power Shell Windows Active Directory PowerShell command list http://technet.microsoft.com/en-us/library/ee617195.aspx A couple of users in Active Directory that we canmanipulate
  • 3.  DCPromo starts up a New Active Directory Forrest For this case your AD should be on its own and not partof a regular AD Domain. All users will be local to the isolated AD Domain The Domain Functional Level in this case does notmatter, you can choose 2003 or 2008 Add DNS and all the features needed for the ADprocess Run Active Directory Users and Computers underAdministrative Tools (start – administrative tools –users and computers)
  • 4.  We want to check out a user to see if the user exists inAD Get-aduser jackfrost
  • 5.  Disable-adaccount jackfrost Enable-adaccount jackfrost
  • 6.  Type sl ad: You should see this prompt
  • 7.  Type DIR (while in SL-AD) You should see this
  • 8.  Set-location“dc=instructorCIS216,dc=highline,dc=edu” Use the FDQN you set up when you installed ActiveDirectory for the location and remember the quotes
  • 9.  Set-location “cn=users” Dir
  • 10.  New-PSDrive –Name instructor –PSProvderActiveDirectory –Root“ad:dc=instructorCIS216,dc=highline,dc=edu”
  • 11.  Get-item“ad:cn=users,dc=instructorCIS216,dc=highline,dc=edu” –Properties samAccountName
  • 12.  Get-item‘ad:cn=users,dc=instructorCIS216,dc=highline,dc=edu’ –Properties *
  • 13.  Import-Module ActiveDirectory$Users = Import-Csv ".myusers.csv"foreach ($User in $Users){$OU = "OU=MyUsers,OU=MyStuff,DC=mydomain,DC=local,DC=com"$Detailedname = $User.firstname + " " + $User.lastname$Firstname = $User.Firstname$FirstLetterFirstname = $Firstname.substring(0,1) #not used this but left it in$SAM = $User.Firstname.tolower() + "." + $user.lastname.tolower()$userprinci = $SAM + "@mydomain.local.com"$logonscript = "logscript.vbs"$homedir = "servermyarea" + $SAM + "My Documents"#tried this alternative#$homedir = "servermyarea%username%My Documents"New-ADUser -Name $Detailedname -SamAccountName $SAM -UserPrincipalName$userprinci -DisplayName $Detailedname -GivenName$user.firstname -Surname $user.lastname -Path $OU -HomeDrive "H:" -HomeDirectory$homedir -scriptpath $logonscript -PasswordNeverExpires $True -PassThru#the password is blank on this example}
  • 14.  You have all the basic commands The script on the preceding page requires a CSV file ofuser names Look at how the script was set up to determine whatshould be in the CSV file, (detailedName, FirstName,FirstLetterFirstName, SAM, ect) Build a CSV with those headers and enter a couple ofentries in the file Attempt to import Submit the CSV file, and a screen cap of the AD UsersContainer with your new people