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,298 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 18

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 18

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Lotus Notes – formerly IBM Notes – is an email client application, while IBM Domino (earlier Lotus Domino) is an email server. The client possesses a set of features that are even more advanced as compared to that of Outlook. Likewise, IBM Domino is…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…

777 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