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,289 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

Too many email signature changes to deal with?

Are you constantly being asked to update your organization's email signatures? Do they take up too much of your time? Wouldn't you love to be able to manage all signatures from one central location, easily design them and deploy them quickly to users. Well, you can!

Join & Write a Comment

Synchronize a new Active Directory domain with an existing Office 365 tenant
Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
In this video we show how to create a Shared Mailbox 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 Recipients >> Sha…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now