I am attempting to place AD Groups over a AD Group Count in a UDGrid. I have used this Code to place the group name in the “Title” but this un-formatable
$UserGroupsCount = @((Get-ADUser $_ -properties MemberOf -ErrorAction Stop).MemberOf | Get-ADGroup ).count
$UserGroups = @((Get-ADUser $_ -properties MemberOf -ErrorAction Stop).MemberOf | Get-ADGroup ).Name
[pscustomobject]@{
enabled = New-UDIcon -Icon $enabled
displayName = $_.displayName
SAMAccountName = $_.SAMAccountName
title = $_.title
GCount = New-UDHtml -Markup "<a href=' ' title='$UserGroups' style='background-color:#FFFFFF;color:#000000;text-decoration:none'>$UserGroupsCount</a>"
This is simple but not very stylish. I tried a UDButton but it got very complicated very quickly and it required a Click to activate.
Just looking for a different point of view.
Thanks in Advance.
Inside my Grids I use ToolTips to display “on hover” information.

New-UDTooltip -Place top -Type info -Effect float -TooltipContent { "30" } -Content {
New-UDHtml -Markup "Markup with Group Name"
}
I personally use a button inside the tooltip, then within the onClick I use Set-UDClipboard to capture whatever hover info I have.
So in a Grid where I have a customer name then the tooltip will display say the customer id when I click the id will be copied to my clipboard. Adds some neat functionality.
New-UDTooltip -Place top -Type info -Effect float -TooltipContent { $_.CustomerId } -Content {
New-UDButton -Text "Customer Name" -OnClick {
Set-UDClipboard -Data $($_.CustomerId)
}
}
4 Likes
Excellent Advice. Thanks for pointing me in the right direction. I modified my code as follows:
$UserGroupsCount = @((Get-ADUser $_ -properties MemberOf -ErrorAction Stop).MemberOf | Get-ADGroup ).count
$UserGroups = (Get-ADUser $_ -properties MemberOf -ErrorAction Stop).MemberOf | Get-ADGroup | sort Name | ConvertTo-Html -Fragment -Property Name
[pscustomobject]@{
enabled = New-UDIcon -Icon $enabled
displayName = $_.displayName
SAMAccountName = $_.SAMAccountName
title = $_.title
GCount = New-UDTooltip -Place right -Type info -Effect float -TooltipContent { New-UDHtml -Markup "$userGroups" } -Content { New-UDHtml -Markup "$UserGroupsCount" }
This allow some simple formating as well without being overly complicated.
Thanks Again.
1 Like