Powershell Mail Configuration

As an alternative to the WebUI, the standard setting plus many more advanced configurations of OutlookLive can be accomplished via PowerShell

One-Time PowerShell Installation and Configuration

The correct version of PowerShell is already part of Windows7 (or Windows Server 2008R2), so for ease of use, please use Windows7. If using an older Windows OS, refer to here for installation .

When first using PowerShell on a particular PC, open a PowerShell window, but make sure to launch it with elevated privileges:

  • click Start Menu (or hit the “Windows” key
  • enter “powershell” and wait for “Windows PowerShell” to get listed in the start menu
  • right-click “Windows PowerShell” and select “Run as Administrator”
  • enter the following command into the PowerShell command console, followed by <Enter>:
    Get-ExecutionPolicy
  • if this does not print “RemoteSigned” as reply, then enter the following command:
    • Set-ExecutionPolicy RemoteSigned
    • <Enter>

Connect to Outlook Live (Exchange Server)

More details on how to connect

First, one needs to connect and establish a remote management session for Exchange server:

$LiveCred=Get-Credential

Note that Get-Credential will prompt for a nN7KE.net admin login, e.g. n7ke, kb7n, w7cf

Next, create the session and import the remoted managment objects:

$Session=New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session

Here an incomplete series of example PS commands to extract member info from some of our mailing lists. The commands all produce a CSV (comma separated values) files that can be imported into Excel for viewing and further processing.

* list all configured MailContacts

Get-Contact -ResultSize Unlimited | Select-Object Identity, FirstName, LastName, WindowsEmailAddress | Export-Csv .\allRtkcc.csv

* list of all mailing groups:

get-group -RecipientType MailUniversalDistributionGroup | sort-object -property identity | select-object Identity, DisplayName, WindowsEmailAddress, Notes | Export-Csv .\mailGroups.csv

* export members of mailing groups:

(Get-Group -identity rtkcc).members | get-contact | sort-object -property Identity | Select-Object Identity, FirstName, LastName, WindowsEmailAddress | Export-Csv .\rtkcc.csv
(Get-Group -identity "RTKCC Members" ).members | get-contact | sort-object -property Identity | Select-Object Identity, FirstName, LastName, WindowsEmailAddress | Export-Csv .\fullMembers.csv
(Get-Group -identity "RTKCC Prospective Members" ).members | get-contact | sort-object -property Identity | Select-Object Identity, FirstName, LastName, WindowsEmailAddress |Export-Csv .\prospectiveMembers.csv
(Get-Group -identity "rtkcc leadership" ).members | get-contact | sort-object -property Identity | Select-Object Identity, FirstName, LastName, WindowsEmailAddress | Export-Csv .\leadership.csv