Get full info
Hello, I run the below shell command but I can not obtain the full information in rows. For instance, when I have loads of users as AcceptMessagesOnlyFrom I got that: {User1 (US1), User2, User3, User4, User5, Use... Is there any way to get the full list without the dots ... ?? Get-DistributionGroup test | ft DisplayName, AcceptMessagesOnlyFrom > DGG_1.txt Thanks in advance, Graig
January 8th, 2010 7:40am

Is there any way to get the full list without the dots ... ??Get-DistributionGroup test | ft DisplayName, AcceptMessagesOnlyFrom > DGG_1.txt Get-DistributionGroup test | List DisplayName, AcceptMessagesOnlyFrom > DGG_1.txt MCTS: Messaging | MCSE: S+M | Small Business Specialist
Free Windows Admin Tool Kit Click here and download it now
January 8th, 2010 8:17am

Thanks Jon-Alfred, I ran the shell command for all the DG starting by t* and the result is much better but I still have for some dots of them (about the AcceptMessagesOnlyFrom) Any idea?
January 8th, 2010 8:48am

All right. See if I can come up with something better this evening. Just tested it with an All Employees Distribution Group where only 7 persons are accepted. And this worked without dots.Do you want the output in a .TXT file or .CSV?MCTS: Messaging | MCSE: S+M | Small Business Specialist
Free Windows Admin Tool Kit Click here and download it now
January 8th, 2010 9:04am

Try this: Get-DistributionGroup test | Select-Object DisplayName, AcceptMessagesOnlyFrom |Out-File DGG_1.txt Karlhttp://unlockpowershell.wordpress.com
January 8th, 2010 10:29am

If you add Format-List, it works here:Get-DistributionGroup test | Select-Object DisplayName, AcceptMessagesOnlyFrom |Format-List | Out-File DGG_1.txtBtw, this is close to how Tony Redmond in his Exchange Server 2007 book suggests you should do it: Get-DistributionGroup SeniorExec | Select Name, AcceptMessagesOnlyFrom |Format-List http://books.google.com/books?id=W3hhKK7rKnYC&pg=PT286&lpg=PT286&dq=AcceptMessagesOnlyFrom+Tony+Redmond&source=bl&ots=6Iy-lDUD50&sig=KT0dVxbtxEwwdAaiNcABjnGv0do&hl=en&ei=YbNKS-nBAsje-QbpsqBM&sa=X&oi=book_result&ct=result&resnum=2&ved=0CAoQ6AEwAQ#v=onepage&q=AcceptMessagesOnlyFrom%20Tony%20Redmond&f=false MCTS: Messaging | MCSE: S+M | Small Business Specialist
Free Windows Admin Tool Kit Click here and download it now
January 10th, 2010 9:28am

This should work. Save the script as a text file with the extension .PS1. Have tested in our production environment and appears to work. # Clear screen for testing purposes Clear-Host # Initialize the dynamic array which will hold all values $totalObj = @() # Get all DGs in the current domain that have message restrictions # and assign them to the array $distAccept $distAccept = Get-DistributionGroup -ResultSize Unlimited -Filter {AcceptMessagesOnlyFrom -ne $null} # Loop through each Distribution Group ($dist) contained in the array ForEach ($dist in $distAccept) { # Assign all senders who are allowed to send to the DG to the array $allowed $allowed = (Get-DistributionGroup -Identity $dist).AcceptMessagesOnlyFrom # Loop through the allowed senders' list (AcceptMessagesOnlyFrom) # the array index starts with 0, so we set the integer $i to 0, # increment the value with 1 ($i++) and stop at 1 less than (-lt) the array count for ($i = 0; $i -lt $allowed.Count; $i++) { # Assign each member to the the variable $member $member = $allowed[$i] # Create instance of object of type .NET $obj = New-Object System.Object # Add the name of the DG to the object, but only the first time with the first record when $i equals 0 if ($i -eq 0) { $obj | Add-Member -MemberType NoteProperty -Value $dist -Name 'Distribution Group' -Force } # Add the member name to the object. Name is a property of member. $obj | Add-Member -MemberType NoteProperty -Value $member.Name -Name 'Accept Messages Only From' -Force -PassThru # Add the object to the array $totalObj += $obj } # End of For Loop } # End of ForEach Loop # You could also do a an Export-Csv, for instance # $totalObj | Export-Csv -NoTypeInformation -Encoding 'Unicode' -Path c:\temp\jas\ngtest.csv $totalObj | Export-Console There’s another script you could look at as well: Cmdlet to get AcceptMessagesOnlyFrom property for Distribution groups http://social.technet.microsoft.com/Forums/en/ITCG/thread/6b5fbd76-8c9a-4d41-b291-9496ba9626e0 MCTS: Messaging | MCSE: S+M | Small Business Specialist
January 10th, 2010 1:45pm

Hello, Sorry for late reply, I did test all the above and I still got dots at the end of the list. Except for the last post from Jon-Alfred Smith :-D Could you please tell me how I could export the list in a csv please?? I removed the # in the below command and change the path but got an error, I think I just don't know how to modify thet perfect script: $totalObj | Export-Csv -NoTypeInformation -Encoding 'Unicode' -Path c:\AcceptMess.csv Thanks
Free Windows Admin Tool Kit Click here and download it now
January 14th, 2010 4:04am

Thank you for your reply, and very nice to hear. We have began to use the script ourselves ...The last three lines of the script should look like this, first line (# You could also ...) is a comment, second ($totalObj | Export-Csv ...) exports to a CSV file, third and last line ($totalObj | Export-Console) is for screen output. Make sure you have write-access to where you put your CSV file.# You could also do a an Export-Csv, for instance$totalObj | Export-Csv -NoTypeInformation -Encoding 'Unicode' -Path c:\temp\test.csv$totalObj | Export-ConsoleIn both cases make sure that you select Unicode instead of Windows ANSIThe delimiter should only be Comma. How to import CSV into EXcel 2003http://www.imibo.com/imidev/hticimexcell.htm Microsoft Excel 2007 - How to Import CSV Fileshttp://www.brighthub.com/computing/windows-platform/articles/10782.aspxMCTS: Messaging | MCSE: S+M | Small Business Specialist
January 14th, 2010 8:10am

thanks a lot Jon-Alfred Smith you have added a great helpful script Qadous
Free Windows Admin Tool Kit Click here and download it now
September 29th, 2012 5:26am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics