Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Show members of a group and count

$
0
0

Hello, I am having a problem getting a list of users of a group and counting them at the same time using convert to html. 

If I use Measure-Object count I then do not get any users listed but do get the count, I have also tried to add a second line with the command included but cannot then get it to show the output.  

Im not really sure how this can be achieved is it a limitation of convertto-html?  

<CODE>

Import-Module ActiveDirectory

$smtpServer = "exch2010"

$smtpFrom = "reports@xyz.com"

$smtpTo = "test@xyz.com"

$messageSubject = "Report: Group Report"

 

$message = New-Object System.Net.Mail.MailMessage $smtpfrom, $smtpto

$message.Subject = $messageSubject

$message.IsBodyHTML = $true

$message.Body = get-adgroupmember -Identity "MY_GROUPNAME" | Select-Object name | ConvertTo-Html -body "<H2>Email Header</H2>"

$smtp = New-Object Net.Mail.SmtpClient($smtpServer)

$smtp.Send($message)

 

Any replies would be appreciated. 


Viewing all articles
Browse latest Browse all 6937

Trending Articles