Solved

Exchange 2007 Management Shell

Posted on 2013-11-10
5
174 Views
Last Modified: 2014-03-12
I have attached script, previously it was work just fine. Lately, we get below error generated for every mailbox before the it generated report file.

You cannot call a method on a null-valued expression.
At line:17 char:72
+     If ($Script:GroupList.ContainsKey($ADObject.sAMAccountName.ToString( <<<< ) + "\") -

eq $False)
You cannot call a method on a null-valued expression.
At line:22 char:72
+     If ($Script:GroupList.ContainsKey($ADObject.sAMAccountName.ToString( <<<< ) + "\" + 

$GroupName))
You cannot call a method on a null-valued expression.

Open in new window

0
Comment
Question by:suriyaehnop
  • 2
  • 2
5 Comments
 
LVL 4

Assisted Solution

by:FutureTechSysDOTcom
FutureTechSysDOTcom earned 200 total points
ID: 39637918
For a test, try eliminating all of the stuff in ToString() and use a manual value.  There were some service packs released recently for Exchange 2007, that could have affected some things.  If you can get it working by using a manual value rather than using the ToString() function then you will know it is just a syntax issue.

Sincerely,
Chris M.
**Advertising deleted by Netminder 11 Nov 2013**
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 39638563
Any chance we could see more of the script? I don't see it attached.
0
 
LVL 18

Author Comment

by:suriyaehnop
ID: 39643439
sorry forgot to attached the full script. I did use this script and run on my Exchange 2010 lab, it working fine but error appeared on my company Exchange 2007 SP2
WindowsPrimary-1.txt
0
 
LVL 31

Accepted Solution

by:
LeeDerbyshire earned 200 total points
ID: 39644249
Does it crash out on the first mailbox, or does it get part of the way through the Get-Mailbox results before crashing? Try adding

$mbx.DisplayName

as the first line inside the foreach loop. I think that should be enough to display each mailbox display name, so that you can see if it processes any at all.
0
 
LVL 18

Author Comment

by:suriyaehnop
ID: 39654429
does it get part of the way through the Get-Mailbox results before crashing.

Where to add Try adding $mbx.DisplayName?
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
In this video we show how to create an email address policy 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…
To show how to generate a certificate request 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 >> Certificates…

914 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

13 Experts available now in Live!

Get 1:1 Help Now