Thursday, April 23, 2020

Corrections to 20345-1A labs module 4

 

Lab 4: Managing Exchange Server and recipient objects by using Exchange Management Shell

Step 0.1 Lab Setup

host computer

Hyper-V Manager

20345-1A-LON-DC1 Start

Connect

Adatum\Administrator Pa55w.rd

20345-1A-LON-EX1 Start

Connect

Adatum\Administrator Pa55w.rd

  

Exercise 1: Using Exchange Management Shell to manage recipients

Step 1.2: Import the Exchange Management Shell module into Windows PowerShell ISE

LON-EX1 Adatum\Administrator Pa55w.rd

Start

Windows PowerShell

right-click Windows PowerShell ISE

More

Run as administrator

 

Import-Module 'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto -ClientApplication:ManagementShell

 

verify that Exchange Management Shell cmdlets are available:

 

Get-ExCommand

 

 

Step 1.3 Explore the recipient-management cmdlets

Get-Command *-Mailbox

 

Get-Mailbox

 

Enable-Mailbox ‘Holly Spencer’

 

Set-Mailbox ‘Holly Spencer’ -HiddenFromAddressListsEnabled $true

 

Step 1.4 Format the output of Exchange Management Shell

 

Get-User -RecipientTypeDetails User | Measure-Object

 

Get-User -RecipientTypeDetails User | Format-Table -Property Name,SamAccountName,Department -AutoSize

 

 

Get-User -RecipientTypeDetails User | Sort-Object Department | Format-Table -Property Name,SamAccountName,Department -AutoSize

 

 

Get-User -RecipientTypeDetails User | Select Name,SamAccountName,Department | Export-Csv C:\Get-User.csv -NoTypeInformation

 

C:\get-user.csv

 

clear the checkbox to Always use this app to open .csv files

Notepad

OK

Close Notepad

 


 Step 1.5: Use pipelining to manage multiple objects

Windows PowerShell ISE

 

Get-User -Filter {department -eq 'Managers'} | Set-User -Title 'Manager'

 

Get-User -RecipientTypeDetails User -Filter {(Department -eq 'IT') -and (LastName -like 'S*')} | Enable-Mailbox

 

Get-User -RecipientTypeDetails UserMailbox -Filter {Department -eq 'IT'} | Get-Mailbox | Add-RoleGroupMember 'Recipient Management'

 

 Step: 1.6 Use variables and loops

 

$mailboxes = Get-Mailbox

 

foreach ($mailbox in $mailboxes) {Write-Host $mailbox.DisplayName}

 

foreach ($mailbox in $mailboxes) {

Write-Host $mailbox.DisplayName

if (($mailbox.DisplayName -ne 'Administrator') -and ($mailbox.DisplayName -ne 'Discovery Search Mailbox')) {

$mailbox | Enable-Mailbox -Archive

}

}

 

Confirm that archive mailboxes were created for each existing mailbox except Administrator and the Discovery Search mailbox.


 Step 1.7: Create a script for bulk-recipient management

Windows PowerShell ISE

File

New

On line 1 of the new script tab, type the following:

 

Import-Module 'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto -ClientApplication:ManagementShell

 

On line 2 of the new script tab, type the following:

 

$csvdata = Import-Csv C:\Get-User.csv

 

On lines 3 through 8 of the new script tab, type the following:

 

foreach ($csvrow in $csvdata) {

$user = Get-User $csvrow.Name

if (($user.RecipientTypeDetails -eq 'User') -and ($user.Department -eq 'Managers') -and ($user.FirstName -like 'B*')) {

$user | Enable-Mailbox

}

}

 

File

Save As

C:\Enable-Mailbox.ps1

File

Exit

Start

Windows PowerShell

right-click Windows PowerShell

More

Run as administrator

 

Copy c:\*.csv

 

. 'C:\Enable-Mailbox.ps1'

 

Confirm that mailboxes were enabled for Burton and Brandan

 

Exit

 


 Exercise 2: Using the Exchange Management Shell to manage Exchange Server

Step 2.8 Configure Exchange Server by using Exchange Management Shell

Windows PowerShell

right-click Windows PowerShell ISE

More

Run as administrator

 

Import-Module 'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto -ClientApplication:ManagementShell

 

 

New-MailboxDatabase -Server LON-EX1 -Name ‘Managers’

 

Note: You will receive the following warning: “Please restart the Microsoft Exchange Information Store service on server LON-EX1 after adding new mailbox databases.”

 OK

 

Mount-Database ‘Managers’

 

Restart-Service MSExchangeIS

 

Get-MailboxDatabaseCopyStatus

 

Step 2-9: Test and monitor Exchange Server by using Exchange Management Shell

 

Test-ServiceHealth

 

Verify that RequiredServicesRunning is True for all roles.

 

Stop-Service MSExchangeIS

 

Test-ServiceHealth

 

Verify that RequiredServicesRunning is False for the Mailbox Server Role

 

Start-Service MSExchangeIS

 

Test-ServiceHealth

 

Verify that RequiredServicesRunning is True for all roles.

 


 Step 3.10 Create a script for database management

File (in Windows PowerShell ISE)

New

On line 1 of the new script tab:

 

Import-Module 'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto -ClientApplication:ManagementShell

 

On line 2 of the new script tab:

 

Get-MailboxDatabase -Server LON-EX1 | Set-MailboxDatabase -DeletedItemRetention 30.00:00:00

 

File

Save As C:\Set-MailboxDatabase.ps1

File

Exit

Start

Windows PowerShell

right-click Windows PowerShell

More

Run as administrator

 

. 'C:\Set-MailboxDatabase.ps1'