Wednesday, August 9, 2017

Connect Remote Exchange Server Function



You can use below function to make connection to remote PS in Exchange 2016.
You will need to change following string $server ="EXC01.smtp25.org" to make it work for you environment.


# Connect Remote PS Exchange 2016 Server, Specify Server to connect.

# Change the server FQDN with server name you desire.
Function Connect_E16 {
    param(
        [Parameter( Mandatory=$false)]
        [string]$server ="EXC01.smtp25.org"
)
        $session = New-PSSession -ConfigurationName Microsoft.Exchange `
        -ConnectionUri http://$srv/PowerShell/ `
        -Authentication Kerberos
         Import-PSSession $session -AllowClobber
}

Clear-host
write-host $null
Write-host "_Connecting Exchange 2016 Servers"
$Connect_E16

Oz Casey, Dedeal
Systems Engineer
http://smtp25.blogspot.com/ (Blog)
http://telnet25.wordpress.com/ (Blog)
https://twitter.com/Message_Talk (Twitter)

2 comments:

Unknown said...

Sometimes is good to use import-pssession with -prefix paramiter. For example when you want to connect to exchange onpremise and exchange online ��

Unknown said...

This Article is Very HelpFul For me You Can Also Visit my Website http://www.hostone.pk/ HostOne is a Pakistan based web hosting company, We Offered You 30% Off Web Hosting in Pakistan providing both providing reliable hosting services since 2011
Best Web Hosting in Pakistan