PowerShell for Exchange Admins



Similar documents
Microsoft. Jump Start. M3: Managing Windows Server 2012 by Using Windows PowerShell 3.0

PowerShell for Dummies

SUNGARD SUMMIT 2007 sungardsummit.com 1. Microsoft PowerShell. Presented by: Jeff Modzel. March 22, 2007 Course ID 453. A Community of Learning

WHITE PAPER POWERSHELL FOR DUMMIES HOW TO KEEP TRACK OF

Acknowledgments Finding Your Way Around Windows PowerShell p. 1 Getting Started with Windows PowerShell p. 3 Installing Windows PowerShell p.

WolfTech Active Directory: PowerShell

Forefront Management Shell PowerShell Management of Forefront Server Products

POWERSHELL (& SHAREPOINT) This ain t your momma s command line!

Exploring PowerShell. Using Windows PowerShell

Jeffrey Snover Distinguished Engineer & Lead Architect Jason Helmick Senior Technologist, Concentrated Technology

Windows PowerShell. 3.0 Step by Step. Ed Wilson

5/13/2009. Dejan Foro Speaker

Things I wish I d known when I started using PowerShell

Powershell Management for Defender

NTWEEKLY.COM - Exchange Server Cmdlets Shell Guide V1.0

Microsoft Windows PowerShell v2 For Administrators

Windows PowerShell Fundamentals

ActiveRoles Management Shell for Active Directory

Using Windows PowerShell to Manage SharePoint 2010

Note: The scripts in this article should work for XenApp 6 and XenApp 5 for Windows Server 2008 and XenApp 5 for Windows Server 2003.


Presented by: Robert Crane BE MBA MVP

Windows Server 2008 R2: Server Management and PowerShell V2

Introduction to PowerShell by Guy Thomas

# Demo: jak to działa?

You Should Be Using PowerShell Aaron Kaiser Senior Technology Support Specialist Parkway School District

Lab Answer Key for Module 1: Installing and Configuring Windows Server Table of Contents Lab 1: Configuring Windows Server

Configuring the Hub Transport Role

Lesson Plans Configuring Exchange Server 2007

Introduction to PowerShell Integration

Lab Sample Solutions. Chapter 3

Exchange 2010 PowerShell Access and Commands for Departmental IT Staff. (CatNet OU Admins)

Exchange 2007 Role Build-In protection ( Overview) Anywhere Access Unified Messaging Console Powershell for Exchange Outlook 2007 and Exchange 2007 :

Unidesk 3.0 Script to Increase UEP Size for Persistent Desktops

Automating Microsoft

POWERSHELL FOR NEWBIES Getting started with PowerShell 4.0. Jeffery Hicks

Create user mailboxes

Self-Service Administration in Exchange Online Dedicated Exchange Server 2010

LEARN EXCHANGE PART 2 Managing your Exchange Architecture

Helping Users Sync Contacts and Events with Exchange Sync (Beta)

ActiveRoles Management Shell for Active Directory

Departmental IT Staff (CatNet OU Admin) Guide to Exchange 2010

GFI Product Guide. GFI Archiver and Office 365 Deployment Guide

Microsoft Exchange Server 2013: Mailbox and High Availability

Wireshark Developer and User Conference

A layman s guide to PowerShell 2.0 remoting. Ravikanth Chaganti

How To Set Up A Journaling Mailbox In Microsoft Office 365 And Gfi Mailarchiver

Windows PowerShell Cookbook

Dejan Foro

ICT dag 03/12 Managing Systems with PowerShell. Bart Portier docent TW KHK Geel Microsoft Certified Trainer

Monitoring and Troubleshooting Microsoft Exchange Server 2007 (5051A) Course length: 2 days

Dell One Identity Manager 7.0. Administration Guide for Connecting to Microsoft Exchange

How To Install An Archive Service On An Exchange Server (For A Free) With A Free Version Of Ios (For Free) On A Windows Xp Or Windows 7 (For Windows) (For An Ubuntu) (

Windows Server 2008 R2: What's New in Active Directory

GETTING STARTED Exclaimer Signature Manager Outlook Edition Overview How does it work? But That's Not All...

Helping Users Sync Contacts and Events with Exchange Sync (Beta)

Automating. Administration. Microsoft SharePoint with Windows. PowerShell 2.0. Gary Lapointe Shannon Bray. Wiley Publishing, Inc.

Helping Users Sync Contacts and Events with Exchange Sync (Beta)

MOC 20342B: Advanced Solutions of Microsoft Exchange Server 2013

Introduction to Installing and Managing Microsoft Exchange Server 2007

Active Directory and Transport Server

DOAG 2011 DP Tricks-1

Windows PowerShell Essentials

The Exchange Management Shell

The Windows PowerShell Owner s Manual: Version 2.0. Jean Ross and Greg Stemp Microsoft Communications Server UA

Windows PowerShell 2.0

Workshop 5051A: Monitoring and Troubleshooting Microsoft Exchange Server 2007

Exchange Service ReadMe and Configuration Setup

How to protect, restore and recover Exchange 2003 and Exchange 2007 databases

IT-Pruefungen.de. Hochwertige Qualität, neueste Prüfungsunterlagen.

Bulk Downloader. Call Recording: Bulk Downloader

8.10. Migrating to Microsoft Office 365

Configuring and Integrating PowerShell

Workshop & Chalk n Talk Catalogue Services Premier Workshop & Chalk n Talk Catalogue

Microsoft MCITP Exam

Using Management Shell Reports and Tracking User Access in the NetVanta UC Server

Clearswift SECURE Exchange Gateway Installation & Setup Guide. Version 1.0

Personal Archiving in Exchange Online

MAPILab Reports Installation Guide. Document version 3.02

Journaling Guide for Archive for Exchange 2007

How To Use Powerpoint In Windows Powerpoint (Windows Powerpoint)

EXAM TS: Microsoft Exchange Server 2010, Configuring. Buy Full Product.

Monitoring Microsoft Forefront Protection 2010 for Exchange Server

Navigate your checklist Before you begin with Exchange Sign up for Office

TS: Microsoft Exchange Server 2010, Configuring

Managing Recipients in Exchange 2007

Administering Microsoft Exchange Server ; 5 Days, Instructor-led

BlackBerry Enterprise Server Express for Microsoft Exchange. Version: 5.0 Service Pack: 4. Upgrade Guide

Office 365 DirSync, ADFS, Single Sign On and Exchange Federation

Question: Hi Everyone! Thank you TEACHERS, MICROSOFT, MVA and Event Support Team for this lesson! Answer: Great to see you POPA DAN!

Restoring an Individual Mailbox(s) Using Exchange 2010

Wakanda Studio Features

Troubleshoot Using Event Log Mining

Published. Technical Bulletin: Use and Configuration of Quanterix Database Backup Scripts 1. PURPOSE 2. REFERENCES 3.

Before you begin with an Exchange 2010 hybrid deployment Sign up for Office 365 for an Exchange 2010 hybrid deployment... 10

ADMINISTERING MICROSOFT EXCHANGE SERVER 2016

Archive Manager Exchange Ed - Advanced Install

Step-by-Step Guide for Monitoring in Windows HPC Server 2008 Beta 2

5.4.8 Optional Lab: Managing System Files with Built-in Utilities in Windows 7

Unix Shell Scripts. Contents. 1 Introduction. Norman Matloff. July 30, Introduction 1. 2 Invoking Shell Scripts 2

Transcription:

PowerShell for Exchange Admins Get-Speaker FL Name : Kamal Abburi Title : Premier Field Engineer Expertise : Exchange Email : Kamal.Abburi@Microsoft.com Blog : mrproactive.com Note: Inspired by my fellow PFEs

What We Do Reactive Support Onsite and Remote Global Community Proactive Services Workshops Health Checks Risk Assessments Supportability Reviews Chalk & Talks Knowledge Transfers Troubleshooting & Root Cause Analysis Technical Leadership Partner with Product Groups 2

Overview PowerShell Exchange and PowerShell Tips and Tricks 3

Architecture PowerShell Engine Exchange Cmdlets AD Registry MAPI Metabase 4

What is PowerShell Command Driven Environment A scripting language Based on.net Framework Unit of operation is a cmdlet Cmdlets are.net classes All Exchange management operations are implemented as PowerShell cmdlets 5

Exchange Management Shell Built upon PowerShell technology Windows Management Framework PowerShell SDK available Role Based Access Control Exchange 2010 6

RBAC and the Shell Source : Technet 7

PowerShell Commands in the EMC Logs every Shell command in the EMC 8

Basics Local Shell Exchange 2007 Windows PowerShell host Windows PowerShell snap-in, contains exchange cmdlets Custom Scripts Cmdlet is always run on the local Exchange server Remote Shell Exchange 2010 Powershell.exe remote connection/session, No Snapin loaded Uses Windows Remote Management 2.0 Gives access to cmdlets that are assigned based on management role No need for Exchange Management Tools, but recommended Note : When you open shell on exchange 2010 server two sessions are created local and remote 9

Edge Role What is that? Uses the local Shell only on the Edge Transport server role Administered individually 10

Remote PowerShell Connect to an Exchange 2010 from a client with WMF installed and no 2010 management tools $usercred = Get-Credential $session = New-PSSession -Configurationname Microsoft.Exchange ConnectionUri http://casservernamefqdn/powershell -Credential $usercred Import-PSSession $session Remove-PSSession $session Set-User kamal-remotepowershellenabled $True 11

Verbs and Nouns New Get Set Add Update Remove Enable Disable Mount Dismount Test Stop Start Resume Retry MailboxDatabase SendConnector Mailbox TransportAgent ActiveSyncDevice SystemHealth ServiceHealth JournalRule MapiConnectivity DistributionGroup MailboxDatabaseCopyStatus 12

cmdlets Get-Command Get-ExCommad Get-Command *mailbox* Get-Command Noun Mailbox Get-Command Verb Restore Tip: Start-Transcript 13

Objects Get-Car Name What_I_Wanted Type: Classic Color: Red Speed: 100 Mileage: 18 Name What_I_Have Type: Family Color: Blue Speed: 60 Mileage: 35 Name What_I_Should Type: Green Color: Green Speed: 20 Mileage: 55 Name What_I_Deserve Type: Not Affordable Color: Red Speed: 250 Mileage: 8 Change Property Set-Car What_I_Have -Color: Sparkling Bronze Metallic Methods Start Drive Stop 14

Lets look at an example Get-Service 15

The Power of TAB PowerShell auto completion Auto complete. Try typing get-a<tab> Scroll through parameters or cmdlets. Try typing Get-Mailbox -<TAB> 16

Get-Help Use help to find cmdlets and categories Get-help *User* Get-help -role *UM* Get-help component *recipient* Use help pages to drill into more detail Get-mailbox -? more Help set-mailbox Get-help get-mailbox Detailed Get-help set-mailbox Examples Get-help set-mailbox Online Get-Help <cmdlet> -Parameter <parameter name> 17

Alias PowerShell Shorthand Notation Aliases are used to shorten common commands in PowerShell. Use get-alias to see all aliases Create your own alias using new-alias Alias dir cd rm rmdir copy echo del move Cmdlet get-childitem set-location remove-item remove-item copy-item write-output remove-item move-item 18

Parameters Provide information to the cmdlet Control how the cmdlet performs its task Verb-Noun -ParameterName <ParameterValue> Types Positional ( Identity ) Named ( Specify the Parameter ) Boolean($true, $false) Switch(confirm) Common(Verbose, Debug, ErrorAction) 19

Syntax Verb-Noun -ParameterName <ParameterValue> hyphen indicates a parameter Space in Parameter Value:Double quotation marks ( " ) Single Quote vs Double Quote "$Server Example $Server Example Escape Character Gold is `$1600 20

Exploring Parameters Explore the properties of output objects using format-list Get-Mailbox TestUser format-list Get-Mailbox TestUser fl *quota* Get-Mailbox TestUser fl * Get-ExchangeServer Status fl * Get-Mailbox FT Name,Database Explore the property types of output objects using getmember Get-storagegroup TestUser get-member Tab it Set-Mailbox-<tab> 21

Operators = value on the right side of the equal sign is assigned to the variable on the left side! logical NOT operator. How do I say Not Equal To >, >> send the output of a command to a file { } Expression $ Variable +,-,*,% -eq, -ne, -Like, -and, -or, -gt, -lt http://technet.microsoft.com/en-us/library/bb125229 Tip: Tee-Object 22

Pipeline What is pipe between cmdlets? 23

Use Cases for Pipeline Bulk management is possible using pipelining Get-Mailbox Set-Mailbox -param1 arg1 -param2 arg2 Piping (cmd1 cmd2) works within same noun Get-Mailbox contoso\joe remove-mailbox And certain different nouns Get-Mailbox contoso\joe Test-MapiConnectivity 24

What are we talking about - Demo 25

Process Data Get-Car Where Color is not Red 26

$_ Get-Car Where Color is not Red Name What_I_Wanted Type: Classic Color: Red Speed: 100 Mileage: 18 Name What_I_Have Type: Family Color: Blue Speed: 60 Mileage: 35 Name What_I_Should Type: Green Color: Green Speed: 20 Mileage: 55 Name What_I_Deserve Type: Not Affordable Color: Red Speed: 250 Mileage: 8 $_.Color $_.Speed $_.Type $_.Color $_.Speed $_.Type 27

Lets Confuse you Get-Mailbox Where-Object {$_.Name like *admin* } Get-Mailbox? {$_.Name like *admin* } Set-Mailbox - ProhibitSendReceiveQuota 10GB Get-Mailbox? {$_.Name like *admin* } Select-Object Name, ProhibitSendReceiveQuota Export-Csv -Path c:\export.csv 28

Pipelining to Pipe Data between Dissimilar Nouns Use the data from one cmdlet with another cmdlet Haven't been optimized to pass objects directly Get-Mailbox Set-Mailbox VS Get-Mailbox New-InboxRule New-InboxRule -Name "Mark as Read" -Mailbox TEST 29

So.. How do we do it? We Know about $_ Get-Mailbox ForEach-Object {Write-Host $_.Name} Get-Mailbox ForEach { New-InboxRule -Name "Mark as Read" -Mailbox $_.Name -From john@contoso.com - MarkAsRead $True} 30

WhatIf, Confirm, and ValidateOnly Switches Whatif Objects that would be affected by running the command and what changes would be made to those objects Confirm Stop processing before any changes are made ValidateOnly Evaluate all the conditions and requirements that are needed to perform the operation before you apply any changes 31

Multi Valued @{Add="chris@contoso.com"} @{Remove="david@contoso.com"} 32

Variables $ $CurrentDate = Get-Date $CurrentDate Get-Member 33

Filtering Built in filter Get-mailbox filter {alias like ka* } Wildcard Get-mailbox admin* Get-ExchangeServer *North* Get-SendConnector *.test.com Where-object (alias where) Get-mailbox where {$_.Alias like *admin* } Get-TransportServer where { $_.MessageTrackingLogEnabled eq $false } 34

Working with Command Output Format-list (FL) Get-Mailbox FL Get-Mailbox FL * Get-Mailbox FL *Quota* Format-table (FT) Get-Mailbox FT Get-Mailbox FT * Get-Mailbox FT Name, Alias,Database Sort-object (sort) Get-mailboxstatistics sort property itemcount desc Group-object (group) Get-mailbox group property Database 35

Import Get-Content Un Structured data Import-Csv Structured data First row = Properties Names All other rows are data Import creates the objects to work with other PowerShell cmdlets 36

Examples To find the number of mailboxes per database: Get-mailbox group property database To find all users who are nearing or over their quota limit: Get-mailboxstatistics where {$_.storagelimitstatus ne BelowLimit } To find all folders with more than 5000 items: Get-mailboxfolderstatistics where {$_.itemsinfolder gt 5000} To find queues in the retry state: Get-queue where {$_.status eg Retry } Get Mailbox Database Size Get-MailboxDatabase -Status select ServerName,Name,DatabaseSize 37

Useful Links http://technet.microsoft.com/en-us/scriptcenter/default http://gallery.technet.microsoft.com/scriptcenter/ http://technet.microsoft.com/enus/scriptcenter/powershell.aspx http://www.microsoft.com/enus/download/details.aspx?id=7097 http://www.microsoft.com/enus/download/details.aspx?id=6268 http://technet.microsoft.com/en-us/library/hh848797 http://blogs.technet.com/b/heyscriptingguy/ 38