Solved

How to modify the following script to ignore / suppress the warning message and export it to TXT file ?

Posted on 2012-03-14
4
1,309 Views
Last Modified: 2012-03-18
Hi People,

Can anyone assist me in modifying the powershell script below to accept array of Mailboxes and then removing the warning of the invalid alias ?

$DGrps = Get-DistributionGroup -ResultSize Unlimited -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
ForEach ($DGrp in $DGrps) {
	.\enumerate_groups.ps1 $DGrp.get_DisplayName() -showTree
}

Open in new window


my current result is as follows:

Group Name:  Payment - FRAUD COMMITTEE
WARNING: Object domain.com/Exchange 2003/Distribution Lists/Payment - FRAUD COMMITTEE has been corrupted and it is in an inconsistent state. The following validation errors have occurred:
WARNING: "Payment - FRAUD COMMITTEE" is not valid for Alias. Valid values are: Strings formed with characters from a to z (uppercase or lowercase), digits from 0 to 9, !, #, $, %, &, ', *, +, -, /, =, ?, ^, _, `, {, |, } or ~. One or more periods may be embedded in an alias, but each one of them should be preceded and followed by at least one of the other characters. Unicode characters from U+00A1 to U+00FF are also valid in an alias, but they will be mapped to a best-fit US-ASCII string in the email address which is generated from such an alias.
Email Addresses:   Payment@domainad.com  
WARNING: Object domain.com/Exchange 2003/Distribution Lists/Payment - FRAUD COMMITTEE has been corrupted and it is in an inconsistent state. The following validation errors have occurred:
WARNING: "Payment - FRAUD COMMITTEE" is not valid for Alias. Valid values are: Strings formed with characters from a to z (uppercase or lowercase), digits from 0 to 9, !, #, $, %, &, ', *, +, -, /, =, ?, ^, _, `, {, |, } or ~. One or more periods may be embedded in an alias, but each one of them should be preceded and followed by at least one of the other characters. Unicode characters from U+00A1 to U+00FF are also valid in an alias, but they will be mapped to a best-fit US-ASCII string in the email address which is generated from such an alias.

Group Members
-------------
John Durham                                                                                                                                                                    
Vina Roger                                                                                                                                                                     
Delon Bingaro                                                                                                                                                                
Total Execution Time:  2812.5 ms

.........

Open in new window


and how to modify so that the result is exported to .TXT file ?

Note: the script is courtesy of: http://www.tinyint.com/index.php/2009/07/17/enumerate-distribution-groups-script-updated/
0
Comment
  • 2
  • 2
4 Comments
 
LVL 19

Expert Comment

by:suriyaehnop
ID: 37723576
Try this:

$WarningPreference = 'SilentlyContinue' #See more about WarningPreference type Get-help *warning*
$DGrps = Get-DistributionGroup -ResultSize Unlimited -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
ForEach ($DGrp in $DGrps) {
	.\enumerate_groups.ps1 $DGrp.get_DisplayName() -showTree
}

Open in new window

0
 
LVL 7

Author Comment

by:Senior IT System Engineer
ID: 37723585
Thanks for the reply man, so how to export that result into Txt file ?
0
 
LVL 19

Accepted Solution

by:
suriyaehnop earned 500 total points
ID: 37724008
$WarningPreference = 'SilentlyContinue' #See more about WarningPreference type Get-help *warning*
$DGrps = Get-DistributionGroup -ResultSize Unlimited -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
$result = ForEach ($DGrp in $DGrps) {
	.\enumerate_groups.ps1 $DGrp.get_DisplayName() -showTree
}

$result | Format-Table Displayname >c:\filename.txt

Open in new window

0
 
LVL 7

Author Comment

by:Senior IT System Engineer
ID: 37727281
thanks for the reply again mate,
however the DG group members is not showing now ?
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question