Introduction
in the Exchange - the time , Microsoft has launched a new set of Shell The management tools :P Owershell V1, and all the graphical interfaces are built on this technology. .
to more tightly integrated in the product ,exchange using the powershell V2, even if your server is on-premises or in the cloud
, powershell V3, With more commands and core functionality to change the 2013 add about 150 commands and because the public folder changes about 15 commands are removed
in this chapter , mainly introduce the following common topics , and some common tasks. , to write some scripts using this latest version . we'll look at some common tasks. , such as scheduling scripts , send e-mail , generate reports, etc. ... ..
Perform a few basic steps
to run all the examples in this chapter , We need Exchange Management Shell, Exchange Management console and a standard PowerShell V3 Control Desk
you can start by following these steps Exchange Management Shell
Login to install there Exchange management tool's Workbench or server
If your computer is not installed Exchange Management Tools , You can use PowerShell Remote Connection , The command is as follows :
$Session = New-pssession-configurationname Microsoft.exchange '
-connectionuri http://mbx01/PowerShell/'
-authentication Kerberos
Import-pssession $Session
in theWindowsin,Click"Start"àAll ProgramsàExchange Server,then openExchange Management Shell,If you are using theWindows Server,need to enterMetroInterface,FindExchange Management Shell,Click to open
Manually Configuring a remote Powershell connection
like exchange 2013 use remote powershell Span style= "font-family: ' The song Body '; > is a very reliable on a workstation or server exchange Management Shell you are using the remote powershell The session is connected to the exchange server
remote also allows you to not install exchange exchange server We'll use the standard powershell console Manually create a remote session to connect to our exchange server for management
we open the console , :
use get-credential command to create a voucher object windows authentication dialog box input has admin exchange user name and password for organization permissions Here the user name should be domain\username or UPN format
$credential = get-credential
650) this.width=650; "title=" 01.png "style=" height:375px;width:720px; "border=" 0 "hspace=" 0 "src=" http:// S3.51cto.com/wyfs02/m02/59/4e/wkiol1tpftjhyb55aaiol0nbz30206.jpg "width=" 720 "height=" 375 "alt=" Wkiol1tpftjhyb55aaiol0nbz30206.jpg "/>
Enter your account and password , Note Format , Click OK
650) this.width=650; "title=" 02.png "style=" Float:none; "src=" http://s3.51cto.com/wyfs02/M02/59/51/ Wkiom1tpffcik5dbaaemfc1khg8192.jpg "alt=" Wkiom1tpffcik5dbaaemfc1khg8192.jpg "/>
650) this.width=650; "title=" 03.png "style=" height:162px;width:720px; "border=" 0 "hspace=" 0 "src=" http:// S3.51cto.com/wyfs02/m00/59/4e/wkiol1tpftizjotcaaehsxvkqh0385.jpg "width=" 720 "height=" 162 "alt=" Wkiol1tpftizjotcaaehsxvkqh0385.jpg "/>
2. Create a Session object and store it in a variable . in the following example , connected to Exchange server has specified -connectionuri Parameters . You can also use the server's FQDN name to replace .
$session = New-pssession-configurationname Microsoft.exchange '
-connectionuri http://mbx01.corp.robin.com/PowerShell/'
-credential $credential
650) this.width=650; "title=" 04.png "style=" height:77px;width:720px; "border=" 0 "hspace=" 0 "src=" http://s3.51cto.com /wyfs02/m00/59/51/wkiom1tpffcqmt8aaaczyia4sge986.jpg "width=" 720 "height=" "alt=" Wkiom1tpffcqmt8aaaczyia4sge986.jpg "/>
3. Finally , Import this Session object
Import-pssession $session
650) this.width=650; "title=" 05.png "style=" height:194px;width:720px; "border=" 0 "hspace=" 0 "src=" http:// S3.51cto.com/wyfs02/m01/59/4e/wkiol1tpftmiywfgaap0uwoj7tm774.jpg "width=" 720 "height=" 194 "alt=" Wkiol1tpftmiywfgaap0uwoj7tm774.jpg "/>
can see , The system's script execution policy has not been modified , Let's change the execution strategy below to see
650) this.width=650; "title=" 06.png "style=" height:121px;width:720px; "border=" 0 "hspace=" 0 "src=" http:// S3.51cto.com/wyfs02/m01/59/51/wkiom1tpffgg0bucaaemslz6uzg356.jpg "width=" 720 "height=" 121 "alt=" Wkiom1tpffgg0bucaaemslz6uzg356.jpg "/>
re-import session , you can see that the import was successful , and Run Exchange command test to see the effect
650) this.width=650; "title=" 07.png "style=" height:296px;width:720px; "border=" 0 "hspace=" 0 "src=" http:// S3.51cto.com/wyfs02/m02/59/4e/wkiol1tpftmdsot2aanyow55qoq267.jpg "width=" 720 "height=" 296 "alt=" Wkiol1tpftmdsot2aanyow55qoq267.jpg "/>
4. When you have executed the above command , Exchange Management Shell will be imported into the current PowerSHell Session
how remote PowerShell works
each runIISservers are supported based on theHTTPthe remotePowerShellSession. Exchangeof the server hostIISalso has aPowerShellthe virtual directory.it contains access rights to perform validation checks and determine which commands and parameters are assigned by the current connection user,Whether you are running locallyExchange PowerShell Shell,or through a remotePowerShellConnection,will perform checks and validations,in theIISin, PowerShellThe virtual directory is in the following path
650) this.width=650; "title=" 08.png "style=" height:310px;width:720px; "border=" 0 "hspace=" 0 "src=" http:// S3.51cto.com/wyfs02/m02/59/51/wkiom1tpffgqsu_uaakw_8mgjze775.jpg "width=" 720 "height=" 310 "alt=" wKiom1TPffGQSU_ Uaakw_8mgjze775.jpg "/>
using remotePowerShellconnected toExchangeServer,This feature is featured inExchangewhen it's already there.,we call it an implicit remote,It allows us to import remote commands into a local session.with this feature,,then our local calculations can be used without the installationExchangeManagement Tools,and through this kind of expedition to connect the way to manage ourExchangeserver..
What we need to be aware of here is : To change our scripting execution policy , Otherwise, there will be a mistake. .
Maybe you'll be curious .,WhyExchangeusing remotePowerShellto manage,even ifExchangeAdministrative tools are installed or run locallyShell.There are several reasons for this .,But the main reason is the authority problem. Exchangeand the -The permissions model is fully converted to the most recent version of the feature,called role-based management(RBAC),Here you can define which access permissions our administrators have.when you perform a remotePowerShellConnect to ourExchangeServer, RBACThe module checks the permissions of the current user with which commands and parameters.
we can use our Help system for more command reference . : Get-help about-remoting
more PowerShell Help Information , You can refer to the following website :
Http://powershell.com/cs/media/p/4908.aspx
This article from "Robin's Home" blog, declined reprint!
To manually configure a remote PowerShell connection for Exchange? PowerShell