Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,

i'm trying to write a C# app that runs exchange PS commands (Get-mailbox and Get-MailboxStatistics)
When i'm testing within MS Visual Studio it works fine... but when i run it standalone i get an error:

"Cannot load Windows PowerShell snap-in Microsoft.Exchange.Management.PowerShell.Admin because of the following error: The t
ype initializer for 'Microsoft.Exchange.Data.Directory.Globals' threw an exception."


any ideas?

Many Thanks,
Phil
Posted
Comments
Ciumac Sergiu 6-Jun-11 9:28am    
Have you tried running the application under Administrative privileges?
Sandeep Mewara 6-Jun-11 11:03am    
Comment from OP:
yes, tried local admins, normal user and domain admins - it always says the same! :(
Philip Lane 6-Jun-11 10:01am    
yes, tried local admins, normal user and domain admins - it always says the same! :(

have u added the dll Microsoft.Exchange.Data.Directory and all reference dll from exchange server.
 
Share this answer
 
Tried the hotfix mentioned on TechNet[^]?
 
Share this answer
 
Comments
Philip Lane 6-Jun-11 11:41am    
i'm using 32bit Windows 7, that only looks although it applied to Windows 2003.
Eddy Vluggen 6-Jun-11 12:43pm    
Looks more like it applies to mixed 32/64 bit environments :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900