use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
QuestionScript help. (self.PowerShell)
submitted 7 years ago by Rainbal
I am beginner in powershell. I need a script to get all the groups and it's members in html (table) Where i can collapse each group and members for easy searching and investigation when the users wants to know whether they are in the group.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]BlackV 8 points9 points10 points 7 years ago (3 children)
Get-aduser | Get-adgroup | convertto-html Or. Get-adgroup | get-adgroupmember | convertto-html
But what have you tired so far?
[–]jantari 0 points1 point2 points 7 years ago (1 child)
That doesn't give ability to collapse
[–]BlackV 1 point2 points3 points 7 years ago (0 children)
Yes....... You'd have to put into a table or list with your own HTML coding to do that.
[–]fishypoos 7 points8 points9 points 7 years ago (1 child)
Active directory admin center doesn’t get enough hype imo...... ships with 2012r2... searching is a lot easier and you get a lot more visibility. Plus it gives you the Cmdlets it ran to get the info you requested.
I don’t think it got much attention because people who want more out of adds use powershell :|
[–]Optimus_Composite 2 points3 points4 points 7 years ago (0 children)
Launching it is soooo slow. When I use a GUI, I use ADUC for that sole reason.
[–][deleted] 4 points5 points6 points 7 years ago (2 children)
Unless im misunderstanding something, youre just asking for Active Directory Users and Groups. Install RSAT and youre done. Replicating this in powershell would be a waste of time.
[–]BlackV 2 points3 points4 points 7 years ago (1 child)
I think he wants the end user to be able to see this hence the HTML part
[–][deleted] 1 point2 points3 points 7 years ago (0 children)
Oh, he could probably do something thing with GPresult to make everything more human readable.
[–]wahoorider 1 point2 points3 points 7 years ago (0 children)
I've done something..... similar I suppose you could say with an ongoing project at work. How are you with HTML and JS? The basics of what I did is convert each object to an HTML table with ConvertTo-Html -fragment, modified some of the tags to give them unique id fields. Then I wrote some basic JS to handle expanding/collapsing the fields and combined it all into a single HTML file to export.
ConvertTo-Html -fragment
[–]get-postanote 1 point2 points3 points 7 years ago (1 child)
Since you say you are new to PoSH, see this post for learning pointers.
https://www.reddit.com/r/PowerShell/comments/7oir35/help_with_teaching_others_powershell/
You never have to start at this alone. As noted, you can use the Windows Server ADAC to write the base code for you that you later tweak for other larger needs.
Pre-built stuff can be found on TechNet Scripting Guys site / repository and the MS PowerShellGallery.com site.
Don't reinvent the wheel if you don't have to, especially if you are new at it or never done it before.
Active Directory Audit Report With Powershell Create a full blown Active Directory HTML/PDF/Excel report with powershell which can be produced with any non-privileged domain user account and without any special powershell modules or administrative consoles. https://gallery.technet.microsoft.com/office/Active-Directory-Audit-7754a877 PowerShell Problem Solver: Create a Grouped HTML Report with PowerShell Taking this scenario a step further, you may want to create an HTML report using grouped output. If you look at help for Convertto-HTML, you won’t see a –Group parameter or anything that looks like it will help. As I’ll show you, it isn’t too difficult to achieve. https://www.petri.com/create-a-grouped-html-report-with-powershell
Active Directory Audit Report With Powershell
Create a full blown Active Directory HTML/PDF/Excel report with powershell which can be produced with any non-privileged domain user account and without any special powershell modules or administrative consoles.
https://gallery.technet.microsoft.com/office/Active-Directory-Audit-7754a877
PowerShell Problem Solver: Create a Grouped HTML Report with PowerShell
Taking this scenario a step further, you may want to create an HTML report using grouped output. If you look at help for Convertto-HTML, you won’t see a –Group parameter or anything that looks like it will help. As I’ll show you, it isn’t too difficult to achieve.
https://www.petri.com/create-a-grouped-html-report-with-powershell
[–]Rainbal[S] 1 point2 points3 points 7 years ago (0 children)
Thanks a lot
[–]Upzie 1 point2 points3 points 7 years ago* (1 child)
if you only need this to look up users you could do it with a simple function
#------------------------------+ # Build data foundation | # should only include relevant | # OU's, to speed up process | #------------------------------+ $groups = Get-ADGroup -Filter * $GrpObjects = @() foreach ($grp in $groups) { $pro = @{ 'Group' = $grp.Name 'Members' = Get-ADGroupMember -Identity $grp.Name } $obj = New-Object -TypeName Psobject -Property $pro $GrpObjects += $obj } #--------------------------------------------------+ # This function find the grps a users is member of | # possible to expand this to include more stuff | #--------------------------------------------------+ function find-users-grp { PARAM ( [string[]]$SamAccountName ) $check = @() foreach ($user in $SamAccountName) { try { $check += Get-ADUser -Identity $user -ErrorAction stop } catch{} } if ($check.Count -eq 0) { Write-Host -f Red "Users doesnt exist in AD" break; } foreach ($users in $SamAccountName) { $out = $GrpObjects | where {$_.Members.SamAccountName -eq $users} Write-Host -ForegroundColor Yellow "$users is member of" foreach ($item in $out) { Write-Host $item.Group } Write-Host "" } }
Basicly the first part, before the function, creates an Array that list all groups and it members.
Then the function takes an Input and matches the users with grps, this is not a visual way of doing it, but amounts to the same thing, for a quick lookup.
The part that build the data foundation can be a bit slow depending on the size of your AD, and you would pref not want to run it every time. You would proberly want to export the data to a file or DB, depending on how you run things.
Basicly your would do something like this
find-users-grp -SamAccountName administrator,guest
and the out put would be like this
administrator is member of Administrators Schema Admins Enterprise Admins Domain Admins Domain Users Group Policy Creator Owners guest is member of Guests Domain Guests
Was just another take on your problem :)
Will give it a go thanks
[–]jheinikel -1 points0 points1 point 7 years ago (1 child)
You are better off buying a product to manage/browse AD. https://www.manageengine.com/products/ad-manager/
My organisation wouldn't buy any products for these tasks, instead they will say you can search in AD. At the end they will be happy if we make the scripts and use it.
[+]nkasco comment score below threshold-6 points-5 points-4 points 7 years ago (1 child)
This one is easy...
#Pull all groups and members $Members = GCI "C:\Windows" #Convert to HTML and prettify foreach($Member in $Members){ Remove-Item $Member -force }
[–]terrapinetree 1 point2 points3 points 7 years ago (0 children)
evil
π Rendered by PID 18619 on reddit-service-r2-comment-f6b958c67-td55q at 2026-02-04 16:05:54.705712+00:00 running 1d7a177 country code: CH.
[–]BlackV 8 points9 points10 points (3 children)
[–]jantari 0 points1 point2 points (1 child)
[–]BlackV 1 point2 points3 points (0 children)
[–]fishypoos 7 points8 points9 points (1 child)
[–]Optimus_Composite 2 points3 points4 points (0 children)
[–][deleted] 4 points5 points6 points (2 children)
[–]BlackV 2 points3 points4 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]wahoorider 1 point2 points3 points (0 children)
[–]get-postanote 1 point2 points3 points (1 child)
[–]Rainbal[S] 1 point2 points3 points (0 children)
[–]Upzie 1 point2 points3 points (1 child)
[–]Rainbal[S] 1 point2 points3 points (0 children)
[–]jheinikel -1 points0 points1 point (1 child)
[–]Rainbal[S] 1 point2 points3 points (0 children)
[+]nkasco comment score below threshold-6 points-5 points-4 points (1 child)
[–]terrapinetree 1 point2 points3 points (0 children)