Exchange 2010, How to run an Exchange Powershell from your Desktop or Batch

by butsch 24. July 2013 20:35

You can use regular Scheduler from Server 2008R2 to start a Powershell direct. But here is how to make a Link

which you can double click.

 

This is what we want:

 

Note your paths from the Powershell Batch and your exchange Install Directory:

Exchange 2010 in: "D:\Program Files\Microsoft\Exchange Server\V14"

Exchange Powershell File you want to run: "C:\batch\reindex.ps1"

 

Make a new Link on your Windows Desktop

Link Start in: "D:\Program Files\Microsoft\Exchange Server\V14\Bin"

Link Target: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -version 2.0 -noexit -command ". 'c:\batch\reindex.ps1'"

File: c:\batch\reindex.ps1

# REINIDEX, V1.0, 24.07.2013

# M. Butsch

# Reindexiert alle Exchange Mailboxdatenbanken Forced

# ---------------------------------------------------

If (@(Get-PSSnapin -Registered | Where-Object {$_.Name -eq "Microsoft.Exchange.Management.PowerShell.E2010"} ).count -eq 1)

    {

    If (@(Get-PSSnapin | Where-Object {$_.Name -eq "Microsoft.Exchange.Management.PowerShell.E2010"} ).count -eq 0)

        {

    Write-Host "Loading Exchange Snapin Please Wait...."

        Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

        }

}

 

cd\

cd "D:\Program Files\Microsoft\Exchange Server\v14\Scripts"

.\ResetSearchIndex.ps1 -force -all

# ---------------------------------------------------

 

The red part is what's missing from regular Windows Powershell TO the yellow Exchange Powershell.

Tags:

Exchange 2007 | Exchange 2010

Comments are closed

Werbung von Drittfirmen (Nicht Butsch Informatik):

Werbung von Drittfirmen via Google Adsense: