Windows power shell and active directory

804
-1

Published on

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

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
804
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

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
  • Windows power shell and active directory

    1. 1. CIS 216Highline Community CollegeDan Morrill
    2. 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. 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. 4.  We want to check out a user to see if the user exists inAD Get-aduser jackfrost
    5. 5.  Disable-adaccount jackfrost Enable-adaccount jackfrost
    6. 6.  Type sl ad: You should see this prompt
    7. 7.  Type DIR (while in SL-AD) You should see this
    8. 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. 9.  Set-location “cn=users” Dir
    10. 10.  New-PSDrive –Name instructor –PSProvderActiveDirectory –Root“ad:dc=instructorCIS216,dc=highline,dc=edu”
    11. 11.  Get-item“ad:cn=users,dc=instructorCIS216,dc=highline,dc=edu” –Properties samAccountName
    12. 12.  Get-item‘ad:cn=users,dc=instructorCIS216,dc=highline,dc=edu’ –Properties *
    13. 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. 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

    ×