Hi All, I need help on this as I am not very familiar with powershell. I need to extract lists of information based on the terms below.
Appreciate if someone could help. Thanks!
As for this ...
I need help on this as I am not very familiar with powershell.
... before taking off on a new thing take a couple of days and get up to speed on it for the basic understanding of what is and is not PowerShell specific and how things needs to be approached.
See this resource to get you started. Remember, YouTube and MSDN Channel9 are your friend and full of videos showing how to use PowerShell in general and use it with Active Directory. Just go there and search for them.
'powershell active directory'https://www.youtube.com/results?search_query=powershell+active+directory
'powershell active directory group membership'https://www.youtube.com/results?search_query=powershell+active+directory+group+membershiphttps://channel9.msdn.com/Search?term=powershell%20ad%20groups&lang-en=true
What you are asking for is very basic PowerShell 101 stuff that you can learn in a couple of hours. Microsoft provide tools that will write the baseline code for you that you can save off an tweak as needed.
You are literally asking folks to write this code for you, with you not showing any effort to work through it. Many will not respond to you or respond to you negatively, with statemtne like, 'this is not a free code writing service. Show us what you've tried, show us what you've searched for.'
Literally, all of what you are asking for is in the PowerShell help file examples as well, in most cases almost 100 %. There are defined cmdlets to access user information in ADDS, but you need to be on the DC to use them, use an implicit or explicit PowerShell Remoting session, or have the Microsoft RSAT (Remote Server Administration Tools) installed and enabled on your workstation. On Windows 10, Windows Server, these tools just need to be enabled.
On Windows 8 and below, you need to download the version for your OS.
For what you are after, you use the *Account*, *User*, *Group*, *Member* cmdlets. Again, see the help file and the help file examples for each of them.
Get-Command -Name '*AD*User*' | Format-Table -AutoSize
CommandType Name Version Source----------- ---- ------- ------...Cmdlet Get-ADUser 22.214.171.124 ActiveDirectory...Cmdlet New-ADUser 126.96.36.199 ActiveDirectory...Cmdlet Remove-ADUser 188.8.131.52 ActiveDirectory...Cmdlet Set-ADUser 184.108.40.206 ActiveDirectory...
Get-Command -Name '*Account*' | Format-Table -AutoSize
CommandType Name Version Source----------- ---- ------- ------...Cmdlet Search-ADAccount 220.127.116.11 ActiveDirectory...
Get-Command -Name '*ADGroup*' | Format-Table -AutoSize
CommandType Name Version Source----------- ---- ------- ------Cmdlet Add-ADGroupMember 18.104.22.168 ActiveDirectory...Cmdlet Get-ADGroup 22.214.171.124 ActiveDirectoryCmdlet Get-ADGroupMember 126.96.36.199 ActiveDirectory...Cmdlet New-ADGroup 188.8.131.52 ActiveDirectory...Cmdlet Set-ADGroup 184.108.40.206 ActiveDirectory...
Get-Command -Name '*Member*' | Format-Table -AutoSize
CommandType Name Version Source----------- ---- ------- ------...Cmdlet Add-ADGroupMember 220.127.116.11 ActiveDirectoryCmdlet Add-ADPrincipalGroupMembership 18.104.22.168 ActiveDirectory...Cmdlet Get-ADGroupMember 22.214.171.124 ActiveDirectoryCmdlet Get-ADPrincipalGroupMembership 126.96.36.199 ActiveDirectory...
Book references, normally the ones you'll see most recommend:
Learn Windows PowerShell in a Month of Lunches 3rd Edition Donald W. Jones (Author), Jeffrey Hicks (Author) ISBN-13: 978-1617294167 ISBN-10: 1617294160
Windows PowerShell Cookbook: The Complete Guide to Scripting Microsoft's Command Shell 3rd Edition Lee Holmes (Author) ISBN-13: 978-1449320683 ISBN-10: 1449320686
Windows PowerShell in Action 3rd Edition by Bruce Payette (Author), Richard Siddaway (Author) ISBN-13: 978-1633430297 ISBN-10: 1633430294
Windows PowerShell Survival Guide
Purpose of this Document The purpose of this document is to help you to learn more about PowerShell and to be successful in applying it. This document seeks to point to the best content on the web to enable you to reach that goal.
Scope of this DocumentThis page contains links to help you learn more about Microsoft Windows PowerShell. This includes PowerShell fundamentals as well as how PowerShell is used in Windows applications and services. As long as it's PowerShell related, we'll try to point to it! The document is also version agnostic, and contains information about current and future versions of PowerShell.
See also posts here for other resource suggestions here:
Learning this stuff.https://www.reddit.com/r/PowerShell/comments/bserj9/learn_powershell/eooduq9/?context=3 https://www.reddit.com/r/PowerShell/comments/bserj9/learn_powershell/eoodxzu/?context=3
Practice with PSKoans
PSKoans : 0.50.0 A module designed to provide a crash-course introduction to PowerShell with programming koans.https://www.powershellgallery.com/packages/PSKoans/0.50.0
*** Very Important ***Lastly, never ever, run any code from any one from anywhere, that you do not fully understand and what it is / will do.
If you do, you could seriously damage your host and or your enterprise. Learn to master the -WhatIf, -Confirm, and leveraging the Set-StrictMode are part of your development, put that in your profile.
Learn about profiles, and how to use them.
Learn about execution policies, what they are and how / when to use them. Fully leverage auditing, monitoring and logging of PowerShell use by all users and processes. Especially as part of your corporate risk management effort.
Powered by IDERA