Tag: Exchange Management Shell

Collection of useful Powershell commands for Server Administration

Collection of useful Powershell commands for Server Administration

Below is a list of useful Powershell commands that I use day to day – This list will be built upon over time:

Windows Server:

Get a list of running services:
Get-Service | Where-Object {$_.Status -eq "Running"}

Microsoft Exchange Server

Connect to Office 365 Exchange Online:
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session

Get list of permissions on a users Mailbox Calendar:
get-MailboxFolderPermission -Identity [email protected]:\Calendar

Add a permission onto a users Mailbox Calendar:
Add-MailboxFolderPermission -Identity [email protected]:\calendar -User [email protected] -AccessRights Editor

Office 365 Administration

Connect to Office 365 via Powershell:
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
Connect-MsolService -Credential $UserCredential

Other Articles that may interest you:
Powershell Cmdlets to remember for the Microsoft 70-346: Managing Office 365 Identities and Requirements Exam

Powershell Cmdlets to remember for the Microsoft 70-347: Enabling Office 365 Services Exam

Installing an SSL Certificate in Exchange 2007 / 2010 and assigning it to Exchange Services

Installing an SSL Certificate in Exchange 2007 / 2010 and assigning it to Exchange Services

SSL Prerequisite(s):

You will have generated a CSR (Certificate Signing Request), prior to this. For an easy way to generate the EMS CSR Command, see here:

Exchange 2007 EMS CRS Command Generator: Exchange 2007 CSR
Exchange 2010 EMS CRS Command Generator: Exchange 2010 CSR

You will have Installed your Intermediate Certificate (via mmc) prior to the below.

——————————————————————————————–

How to Import the SSL Certificate

From an elevated Exchange Management Shell, run the following command to import the SSL Certificate into Exchange 2007 \ 2010:

Import-ExchangeCertificate -FileData ([Byte[]]$(Get-Content -Path c:\certificates\YOUR_CERTIFICATE.cer -Encoding byte -ReadCount 0))

Note: Replace “c:\certificates\YOUR_CERTIFICATE.cer” with the path of your Certificate location

——————————————————————————————–

To enable the Certificate and assign it to the relevant services, run the following command:

Assign Certificate in Exchange 2007:
Enable-ExchangeCertificate -Thumbprint *Insert Thumbprint* -Services “POP,IMAP,SMTP,IIS”

Note: replace *Insert Thumbprint* with $your_Thumbprint (you will see this in the output of the previous command).

Assign Certificate in Exchange 2010:
Enable-ExchangeCertificate -Thumbprint *Insert Thumbprint* -Services POP,IMAP,SMTP,IIS

Note: replace *Insert Thumbprint* with $your_Thumbprint (you will see this in the output of the previous command).

Original Source:
https://support.comodo.com/index.php?/Knowledgebase/Article/View/712/37/certificate-installation-exchange-2010-powershell