Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Issues with loading Exchange Commandlets from batch file

$
0
0

Hi,

I have a powershell script which loads active directory module and exchange commandlets. This works fine if I run file.ps1 within powershell ISE. When I try to run file.ps1 from a batch file I get an error saying

"The Error generated was: Cannot load Windows PowerShell snap-in Microsoft.Exchange.Management.PowerShell.E2010 because of the following error: The type initializer for 'Microsoft.Exchange.Data.Directory.Globals' threw an exception"

My batch file looks like this:

call C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -File C:\file\file.ps1

Please kindly shed some light on this.

Thank you.


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>