SlideShare a Scribd company logo
PowerShell for Managing Active DirectoryRavikanth C
About meLead Engineer at DellWindows PowerShell MVPDeveloper on several PowerShell projects on CodeplexAuthor ofFree eBook: Layman’s guide to PowerShell 2.0 remotingCo-author on Quest’s SharePoint 2010 & PowerShell cheat sheetBlog at http://www.ravichaganti.com/blogFounder & editor of PowerShellFromIndiaMore details on this soon 
Giving away..Two copies (eBook) of Managing Active Directory with Windows PowerShell: TFMThanks to Sapien PressOne copy (eBook) of Windows PowerShell CookbookThanks to O'Reilly Media
PowerShell for Active Directory[ADSI] adapterIn-boxWindows Server 2008 R2 includes a PowerShell moduleIn-boxQuest Software ActiveRoles Management ShellFree downloadSofterra Adaxes 2010.2Commercial productIdera Scripts for Active DirectoryFree; uses [ADSI]
PowerShell for Active DirectoryMicrosoft cmdletsQuest cmdletsPowerShell 2.0 onlyRequire AD Management Gateway for managing pre-Windows 2008 R2 DCCannot manage local LDSCannot manage terminal services attributesVersion IndependentSupport Windows 2003, 2008, and 2008 R2 DC managementCan manage local LDSCan manage terminal services attributes
Microsoft cmdlets for Active DirectoryIn-box from Windows Server 2008 R2 onwardsGet enabled byInstalling AD DS or LDS server roles orRunning DCPromo.exe orInstalling RSAT on Windows Server 2008 R2 or Windows 7To access AD cmdletsStart->Administrative Tools->Active Directory Module for Windows PowerShell or Import-Module ActiveDirectoryTo list AD cmdletsGet-Command -noun AD* orGet-Command –Module ActiveDirectory
Managing down level serversRequires AD Management Gateway Services
AD PowerShell cmdlets & ADAC use AD web servicesto administer directory
Available for Windows2003 R2 with SP22003 SP220082008 SP2 Microsoft cmdlets for Active DirectoryCmdlets can be grouped underForests & DomainsUser & Computer accountsGroupsPassword PoliciesOU tasksService AccountsSchema Tasks
Forest & DomainsGet-ADForestSet-ADForestSet-ADForestModeGet-ADDomainSet-ADDomainMode
User AccountsGet-ADUserNew-ADUserSet-ADUserRemove-ADUserDisable-ADAccountEnable-ADAccountSet-ADAccountExpirationClear-ADAccountExpirationSet-ADAccountPasswordUnlock-ADAccount
GroupsGet-ADGroupNew-ADGroupSet-ADGroupRemove-ADGroupGet-ADGroupMemberAdd-ADGroupMemberRemove-ADGroupMember
OU tasksGet-ADOrganizationalUnitNew- ADOrganizationalUnit
Service AccountsGet-ADServiceAccountNew-ADServiceAccountSet-ADServiceAccount Install-ADServiceAccount Uninstall-ADServiceAccount Reset-ADServiceAccountPassword
AD Recycle BinEnable AD Optional Feature: “Recycle Bin Feature”This is an irreversible actionRestore-ADObject to restore deleted objects
Moving an AD ObjectUse Get-ADObject to get an instancePipe it to Move-ADObject and specify new location as a value to -TargetPath
Learning Resources – PowerShell for ADCmdlet referenceBook: Managing Active Directory with PowerShell: TFMAD cmdlets quick reference guideAdaxes CmdletsQuest CmdletsIdera PowerShell ScriptsADMGS for down level servers
Learning resources - PowerShellGetting started guidePowerShell Learning centerThe scripting Guys blogPowerScripting PodcastPowerShell.com free online eBook

More Related Content

What's hot (20)

PPT
New Features Of ASP.Net 4 0
Dima Maleev
 
PPTX
AWS Atlanta meetup Build Tools - Code Commit, Code Build, Code Deploy
Adam Book
 
PPT
SynapseIndia dotnet website security development
Synapseindiappsdevelopment
 
PPTX
Play with force.com metadata
Rakesh Kumar Kedia
 
PPTX
Building & managing wa app wely
Spiffy
 
PPT
Web controls
Sarthak Varshney
 
PPTX
Integration of linked in using mule esb
Sanjeet Pandey
 
PPTX
Integration with Microsoft SharePoint using Mule ESB
Sanjeet Pandey
 
PPTX
Automatic documentation with mule
F K
 
PPTX
Mule using Salesforce
Khasim Cise
 
PPTX
Asp Net Advance Topics
Ali Taki
 
PPT
Siebel Web Service
NAVINKUMAR RAI
 
PPT
Microsoft Azure
Dima Maleev
 
PPTX
Mule
F K
 
PPT
Server Controls of ASP.Net
Hitesh Santani
 
PPTX
Creating AppStream apps and configuring users with Domain Join.
Subramanyam Vemala
 
PPTX
Integration with Microsoft CRM using Mule ESB
Sanjeet Pandey
 
PDF
Android dev tips
Kanda Runapongsa Saikaew
 
PPSX
ASP.NET Web form
Md. Mahedee Hasan
 
PDF
Configure an Integrated Exchange, Lync, and SharePoint Test Lab
Vinh Nguyen
 
New Features Of ASP.Net 4 0
Dima Maleev
 
AWS Atlanta meetup Build Tools - Code Commit, Code Build, Code Deploy
Adam Book
 
SynapseIndia dotnet website security development
Synapseindiappsdevelopment
 
Play with force.com metadata
Rakesh Kumar Kedia
 
Building & managing wa app wely
Spiffy
 
Web controls
Sarthak Varshney
 
Integration of linked in using mule esb
Sanjeet Pandey
 
Integration with Microsoft SharePoint using Mule ESB
Sanjeet Pandey
 
Automatic documentation with mule
F K
 
Mule using Salesforce
Khasim Cise
 
Asp Net Advance Topics
Ali Taki
 
Siebel Web Service
NAVINKUMAR RAI
 
Microsoft Azure
Dima Maleev
 
Mule
F K
 
Server Controls of ASP.Net
Hitesh Santani
 
Creating AppStream apps and configuring users with Domain Join.
Subramanyam Vemala
 
Integration with Microsoft CRM using Mule ESB
Sanjeet Pandey
 
Android dev tips
Kanda Runapongsa Saikaew
 
ASP.NET Web form
Md. Mahedee Hasan
 
Configure an Integrated Exchange, Lync, and SharePoint Test Lab
Vinh Nguyen
 

Viewers also liked (19)

PPTX
the Stairway to PowerShell in Office365
Thorbjørn Værp
 
PPTX
Windows power shell and active directory
Dan Morrill
 
PDF
Collab365: PowerShell for Office 365
Vlad Catrinescu
 
PPTX
Réduisez vos Coûts d'Administration et les Risques d'erreurs avec Windows Pow...
Patrick Guimonet
 
PPT
2008-09-30 Administration automatisée avec Powershell
Patrick Guimonet
 
PPTX
Powershell et les techniques de remoting
Microsoft Technet France
 
PPTX
Power Shell V2 en action - avec Posh Board 2.0
Patrick Guimonet
 
PDF
F Les Scripts En Power Shell
UGAIA
 
PDF
Automatisez rapidement vos opérations IT, on-premise ou dans le Cloud avec Az...
Microsoft Technet France
 
PPTX
Powershell Demo Presentation
Avik Bhattacharyya
 
PDF
PowerShell Tips & Tricks for Exchange
Michel de Rooij
 
PDF
O365con14 - powershell for exchange administrators
NCCOMMS
 
PDF
Cao COMT manuscript
yufeicao
 
PPT
Powershell
UGAIA
 
ODP
An Introduction to Windows PowerShell
Dale Lane
 
PPTX
Comment automatiser les commandes PowerShell pour optimiser la performance d'...
Microsoft Décideurs IT
 
PDF
Shell sans les coquilles
Édouard Lopez
 
PPTX
Sp summit2014 session 10-2
Nikolas Charlebois-Laprade
 
PDF
The Top Skills That Can Get You Hired in 2017
LinkedIn
 
the Stairway to PowerShell in Office365
Thorbjørn Værp
 
Windows power shell and active directory
Dan Morrill
 
Collab365: PowerShell for Office 365
Vlad Catrinescu
 
Réduisez vos Coûts d'Administration et les Risques d'erreurs avec Windows Pow...
Patrick Guimonet
 
2008-09-30 Administration automatisée avec Powershell
Patrick Guimonet
 
Powershell et les techniques de remoting
Microsoft Technet France
 
Power Shell V2 en action - avec Posh Board 2.0
Patrick Guimonet
 
F Les Scripts En Power Shell
UGAIA
 
Automatisez rapidement vos opérations IT, on-premise ou dans le Cloud avec Az...
Microsoft Technet France
 
Powershell Demo Presentation
Avik Bhattacharyya
 
PowerShell Tips & Tricks for Exchange
Michel de Rooij
 
O365con14 - powershell for exchange administrators
NCCOMMS
 
Cao COMT manuscript
yufeicao
 
Powershell
UGAIA
 
An Introduction to Windows PowerShell
Dale Lane
 
Comment automatiser les commandes PowerShell pour optimiser la performance d'...
Microsoft Décideurs IT
 
Shell sans les coquilles
Édouard Lopez
 
Sp summit2014 session 10-2
Nikolas Charlebois-Laprade
 
The Top Skills That Can Get You Hired in 2017
LinkedIn
 
Ad

Similar to Using PowerShell for active directory management (20)

PDF
AD Cmdlets
Brian McCann
 
PPTX
Automating AD Domain Services Administration
Napoleon NV
 
PPTX
Microsoft Offical Course 20410C_04
gameaxt
 
PDF
I Have the Power(View)
Will Schroeder
 
PPTX
Installation and Adminstration of AD_MVP Padman
Quek Lilian
 
PPTX
Active Directory 2008 R2 Updates
Amit Gatenyo
 
PDF
Beyond the mcse red teaming active directory
Priyanka Aash
 
PPT
Automating Active Directory mgmt in PowerShell
Concentrated Technology
 
PPTX
Mark Minasi What’S New In Active Directory For Windows 7 Server 2008 R2
Nathan Winters
 
PPTX
SIA319 What's Windows Server 2008 R2 Going to Do for Your Active Directory?
Louis Göhl
 
PDF
DEF CON 24 - Sean Metcalf - beyond the mcse red teaming active directory
Felipe Prado
 
PDF
Server-410_RatanMohapatra
Ratan Mohapatra
 
PDF
E brochure it254_actived2012
I-r Papa
 
PDF
Windows server 2012 r2 abdullah hassan al alyani
Aeliani92
 
PPTX
Advanced Directory Services Windows Server 2012
Виталий Стародубцев
 
PDF
How To Connect To Active Directory PowerShell
VCP Muthukrishna
 
PDF
Material modulo04 asf6501(6425-a_01)
JSantanderQ
 
PPT
Automating ad with powershell
Concentrated Technology
 
PDF
Material modulo03 asf6501(6425-b_02)
JSantanderQ
 
PDF
Active directory installation on windows server 2012
Ricardo Solís
 
AD Cmdlets
Brian McCann
 
Automating AD Domain Services Administration
Napoleon NV
 
Microsoft Offical Course 20410C_04
gameaxt
 
I Have the Power(View)
Will Schroeder
 
Installation and Adminstration of AD_MVP Padman
Quek Lilian
 
Active Directory 2008 R2 Updates
Amit Gatenyo
 
Beyond the mcse red teaming active directory
Priyanka Aash
 
Automating Active Directory mgmt in PowerShell
Concentrated Technology
 
Mark Minasi What’S New In Active Directory For Windows 7 Server 2008 R2
Nathan Winters
 
SIA319 What's Windows Server 2008 R2 Going to Do for Your Active Directory?
Louis Göhl
 
DEF CON 24 - Sean Metcalf - beyond the mcse red teaming active directory
Felipe Prado
 
Server-410_RatanMohapatra
Ratan Mohapatra
 
E brochure it254_actived2012
I-r Papa
 
Windows server 2012 r2 abdullah hassan al alyani
Aeliani92
 
Advanced Directory Services Windows Server 2012
Виталий Стародубцев
 
How To Connect To Active Directory PowerShell
VCP Muthukrishna
 
Material modulo04 asf6501(6425-a_01)
JSantanderQ
 
Automating ad with powershell
Concentrated Technology
 
Material modulo03 asf6501(6425-b_02)
JSantanderQ
 
Active directory installation on windows server 2012
Ricardo Solís
 
Ad

More from Ravikanth Chaganti (20)

PPTX
Azure Bicep - An Introduction
Ravikanth Chaganti
 
PPTX
Azure CLI 2.0 Tips and Tricks
Ravikanth Chaganti
 
PPTX
Tests Driven PowerShell Learning
Ravikanth Chaganti
 
PPTX
PowerShell Data as File System
Ravikanth Chaganti
 
PPTX
Azure at the command line
Ravikanth Chaganti
 
PPTX
Microsoft Azure Cloud and DevOps
Ravikanth Chaganti
 
PPTX
Using PowerShell DSC with AWS Cloud and CloudFormation
Ravikanth Chaganti
 
PPTX
Developing Infrastructure Code for CI & CD
Ravikanth Chaganti
 
PPTX
PowerShell DSC Partial Configurations and Cross-node Synchronization
Ravikanth Chaganti
 
PPTX
Operations Validation for Infrastructure As Code - PSConfEU 2016
Ravikanth Chaganti
 
PPTX
Authoring Azure Resource Manager Templates - Future Unleashed 2015
Ravikanth Chaganti
 
PPTX
Cloud Computing for IT professionals
Ravikanth Chaganti
 
PPTX
Introduction to Microsoft Azure Compute
Ravikanth Chaganti
 
PPTX
Cross platform configuration management using Desired State Configuration
Ravikanth Chaganti
 
PPTX
Windows Server 2012 R2 Hyper-V Replica
Ravikanth Chaganti
 
PPTX
Whats new in Windows Server 2012 R2 Hyper-V
Ravikanth Chaganti
 
PPTX
Configuration management comes to Windows
Ravikanth Chaganti
 
PPT
Desired state-configuration-ravikanth-august-2013-vtc india
Ravikanth Chaganti
 
PPTX
Power shell saturday ravikanth
Ravikanth Chaganti
 
PPTX
PowerShell 3.0 workflows
Ravikanth Chaganti
 
Azure Bicep - An Introduction
Ravikanth Chaganti
 
Azure CLI 2.0 Tips and Tricks
Ravikanth Chaganti
 
Tests Driven PowerShell Learning
Ravikanth Chaganti
 
PowerShell Data as File System
Ravikanth Chaganti
 
Azure at the command line
Ravikanth Chaganti
 
Microsoft Azure Cloud and DevOps
Ravikanth Chaganti
 
Using PowerShell DSC with AWS Cloud and CloudFormation
Ravikanth Chaganti
 
Developing Infrastructure Code for CI & CD
Ravikanth Chaganti
 
PowerShell DSC Partial Configurations and Cross-node Synchronization
Ravikanth Chaganti
 
Operations Validation for Infrastructure As Code - PSConfEU 2016
Ravikanth Chaganti
 
Authoring Azure Resource Manager Templates - Future Unleashed 2015
Ravikanth Chaganti
 
Cloud Computing for IT professionals
Ravikanth Chaganti
 
Introduction to Microsoft Azure Compute
Ravikanth Chaganti
 
Cross platform configuration management using Desired State Configuration
Ravikanth Chaganti
 
Windows Server 2012 R2 Hyper-V Replica
Ravikanth Chaganti
 
Whats new in Windows Server 2012 R2 Hyper-V
Ravikanth Chaganti
 
Configuration management comes to Windows
Ravikanth Chaganti
 
Desired state-configuration-ravikanth-august-2013-vtc india
Ravikanth Chaganti
 
Power shell saturday ravikanth
Ravikanth Chaganti
 
PowerShell 3.0 workflows
Ravikanth Chaganti
 

Recently uploaded (20)

PDF
Proactive Server and System Monitoring with FME: Using HTTP and System Caller...
Safe Software
 
PDF
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
 
PDF
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
PDF
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
PPTX
Practical Applications of AI in Local Government
OnBoard
 
PDF
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
PDF
Understanding AI Optimization AIO, LLMO, and GEO
CoDigital
 
PDF
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
PDF
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
 
PDF
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PPTX
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
PPTX
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PDF
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
PDF
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
PDF
''Taming Explosive Growth: Building Resilience in a Hyper-Scaled Financial Pl...
Fwdays
 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
Proactive Server and System Monitoring with FME: Using HTTP and System Caller...
Safe Software
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
Kubernetes - Architecture & Components.pdf
geethak285
 
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
Practical Applications of AI in Local Government
OnBoard
 
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
Understanding AI Optimization AIO, LLMO, and GEO
CoDigital
 
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
 
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
''Taming Explosive Growth: Building Resilience in a Hyper-Scaled Financial Pl...
Fwdays
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 

Using PowerShell for active directory management

Editor's Notes

  • #5: $users = [ADSI]"LDAP://cn=users,dc=barcamp,dc=in“[ADSI] can get quite verbose as we start doing advanced tasks
  • #10: Get-ADForest BarCamp.inGet-ADForest –Current LoggedOnUserGet-ADForest –Current LocalComputerSet-ADForest can be used to change Authentication Type, UPNSuffixes and SPNSuffixe (Default is negotiate. Basic requires SSL)Set-ADForestMode changes the forest functional mode.Set-ADForestMode -Identity BarCamp.in -ForestMode Windows2008R2ForestPossible values for this parameter are: Windows2000Forest or 0 Windows2003InterimForest or 1 Windows2003Forest or 2 Windows2008Forest or 3 Windows2008R2Forest or 4Get-ADDomain BarCamp.in(Get-AdDomain).DomainModeSet-AdDomainMode –DomainMode Windows2008R2DomainWindows2000Domain or 0Windows2003InterimDomain or 1Windows2003Domain or 2Windows2008Domain or 3Windows2008R2Domain or 4
  • #11: #To Get specific user detailsGet-ADUser –Identity “Ravikanth”#To filter by UserNameGet-ADUser –Filter ‘Name –like ‘Ravi*’”#To filter from a selected OUGet-ADUser -Filter * -SearchBase "CN=Users,DC=BarCamp,DC=in“#To see additional properties than the default setGet-ADUser –Filter ‘Name –like ‘Admin*’” –Properties Description#To see all propertiesGet-AdUser "Ravikanth" -Properties *New-ADUser-Name “Bill Gates" -SamAccountName“BillG" -GivenName“Bill" -Surname “Gates" -DisplayName“Bill Gates" -Path ‘CN=Users,DC=BarCamp,DC=in' -OtherAttributes@{'Title'=“God at Microsoft"} -AccountPassword (Read-Host -AsSecureString"AccountPassword") -Enabled $true#Change user propertiesSet-ADUser Ravikanth -City Bangalore -Replace @{title="PowerShell MVP";Description="Is a part of Domain Users"}Set-ADUser Ravikanth -Clear Description#Remove UserAccountRemove-ADUser "Rchaganti”#Disable AccountDisable-ADAccount -Identity Ravikanth#Enable AccountEnable-ADAccount -Identity Ravikanth#Set account Expiry dateSet-ADAccountExpiration -Identity Ravikanth -DateTime "12/31/2010"#Clear Account ExpiryClear-ADAccountExpiration -Identity Ravikanth#Set Account PasswordSet-ADAccountPassword -Identity Ravikanth ` -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "Warri0r@" -Force)#Unlock AccountUnlock-ADAccount Ravikanth
  • #12: #Get AD GroupGet-ADGroupDomainUsersGet-ADGroup -Filter *#New AD GroupNew-ADGroup -Name "Bitpro" -SamAccountName "Bitpro" -GroupScope Global -Path "DC=BarCamp,DC=in“#Remove-ADGroupRemove-ADGroup -Identity BITPro -Confirm#Get AD Group memberGet-ADGroupMember -Identity Administrators#Add a user to groupAdd-ADGroupMember -Identity DemoUsers -Members Ravikanth#Remove group membersRemove-ADGroupMember -Identity DemoUsers -Members Ravikanth
  • #13: #OUGet-ADOrganizationalUnit -Filter *Get-ADOrganizationalUnit -Filter * -Properties *#Create OUNew-ADOrganizationalUnit -DisplayName "DemoOU" -Name "DEMOOU" -Path "DC=BarCamp,DC=in"
  • #14: #Get-ADServiceAccountGet-ADServiceAccount -Filter *#New AD Service AccountNew-ADServiceAccount -Name DemoService -DisplayName "Demo Service Account" ` -Path "OU=DEMOOU,DC=BarCamp,DC=in" ` -AccountPassword (ConvertTo-SecureString -AsPlainText "Warri0r@" -Force)#remove AD Service AccountRemove-ADServiceAccountDemoService#Install AD Service AccountInstall-ADServiceAccountDemoService#UnInstall AD Service AccountUnInstall-ADServiceAccountDemoService#Reset AD Service AccountPasswordReset-ADServiceAccountPassword -Identity DemoService
  • #15: #Enable Recycle BinEnable-ADOptionalFeature 'Recycle Bin Feature' -Scope ForestOrConfigurationSet -Target 'BarCamp.in'#Restore AD Object from recycle binGet-ADObject -Filter 'samaccountname -eq "rchaganti"' -IncludeDeletedObjectsGet-ADObject -Filter 'samaccountname -eq "rchaganti"' -IncludeDeletedObjects | Restore-ADObject
  • #16: $user=Get-ADObject -Filter "SamAccountName -eq 'RChaganti'"$user | Move-ADObject -TargetPath "CN=Users,DC=BarCamp,DC=in"