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.