- First, create a credential object using the Get-Credential cmdlet. When running this command, you'll be prompted with a Windows authentication dialog box. Enter a username and password for an account that has administrative access to your Exchange organization. Make sure you enter your user name in DOMAIN\USERNAME or UPN format (username@domain.com):
$credential = Get-Credential
- Next, create a new session object and store it in a variable. In this example, the Exchange server we are connecting to is specified using the -ConnectionUri parameter. Replace the server FQDN in the following example with one of your own Exchange servers:
$session = New-PSSession -ConfigurationName Microsoft.Exchange `
-ConnectionUri http://tlex01.testlabs.se/PowerShell/ ...