Windows power shell and active directory

on

  • 953 views

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

Statistics

Views

Total Views
953
Views on SlideShare
953
Embed Views
0

Actions

Likes
0
Downloads
1
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • 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 Windows power shell and active directory Presentation Transcript

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