Exchange Running Powershell from Batch on Server 2008/R2, 32/64BIT

by butsch 19. October 2011 18:35

Exchange Running Powershell from Batch on Server 2008/R2 32/64BIT, c:\windows\Sysnative Patch

If your recieve the error while running a Powershell from Batch:

WARNING: The following errors occurred when loading console D:\ProgramFiles\Microsoft\Exchange Server\bin\exshell.psc1:
Cannot load Windows PowerShell snap-in Microsoft.Exchange.Management.PowerShell.Admin because of the following error:
No snap-ins have been registered for Windows PowerShell version 2.
Command 'c:\batch\butsch.ps1' could not be executed because so me Windows PowerShell snap-ins did not load.

You may have to call the Powershell from within the Batch this way:

my_batch.cmd

:: 64BIT  C:\Windows\SysWOW64\WindowsPowerShell\v1.0\PowerShell.exe
:: 32BIT  C:\WINDOWS\system32\WindowsPowerShell\v1.0\PowerShell.exe
:: 32BIT  C:\Windows\Sysnative\WindowsPowerShell\v1.0\PowerShell.exe < Server 2008 and R2 64BIT if you call the Powershell from DOS Batch.
c:
cd "D:\Program Files\Microsoft\Exchange Server\bin"
C:\Windows\Sysnative\WindowsPowerShell\v1.0\PowerShell.exe -PSConsoleFile "D:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -noexit -command "c:\batch\butsch.ps1"

The sysnative was the soltion and not registering Components new or compiling the batch with 64BIT (In some surounding code with .exe)


The Hotfix which is mentioned in almost 70% of the Blogs is for Server 2003 and not for 2008.

http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/41c9cd78-74ad-4903-8a77-be6c09724669

 

Tags:

Exchange 2007 | Exchange 2010 | Server 2008 R2

Comments are closed

Werbung von Drittfirmen (Nicht Butsch Informatik):

Werbung von Drittfirmen via Google Adsense: