View
2.748
Download
2
Tags:
Embed Size (px)
DESCRIPTION
Using PowerShell for Exchange Mangement
Citation preview
Harold WongHarold WongSenior Technology SpecialistSenior Technology SpecialistMicrosoft CorporationMicrosoft Corporation
24 Hours of Exchange Server 2007 24 Hours of Exchange Server 2007 (Part 09 of 24): Using PowerShell (Part 09 of 24): Using PowerShell for Exchange Managementfor Exchange Management
What We Will CoverWhat We Will Cover
• Exchange Server Management modelExchange Server Management model
• Common management tasksCommon management tasks
• Scripting Exchange Server tasksScripting Exchange Server tasks
Level 200
Helpful ExperienceHelpful Experience
• Experience with Windows ServerExperience with Windows Server®® 2003 2003
• Experience with MicrosoftExperience with Microsoft®® Exchange Server Exchange Server
• Familiarity with scriptingFamiliarity with scripting
AgendaAgenda
• ReviewReview
• Managing Exchange Server with Windows Managing Exchange Server with Windows PowerShell™PowerShell™
• Windows PowerShell ScriptingWindows PowerShell Scripting
Review: Introduction to Windows Review: Introduction to Windows PowerShellPowerShell
• New command line and scripting utilityNew command line and scripting utility
• Manage all aspects of Exchange ServerManage all aspects of Exchange Server
• Automate management tasksAutomate management tasks
Review: Introduction to Windows Review: Introduction to Windows PowerShellPowerShell
What is the purpose of the pipeline?What is the purpose of the pipeline?
1.1. Redirect output to text filesRedirect output to text files
2.2. Use the output of one command as the input for Use the output of one command as the input for anotheranother
3.3. Read input from the keyboardRead input from the keyboard
4.4. Temporarily pause the scriptTemporarily pause the script
Review: Introduction to Windows Review: Introduction to Windows PowerShellPowerShell
Which CMDLET retrieves information about Which CMDLET retrieves information about
a user’s Exchange Server mailbox?a user’s Exchange Server mailbox?
1.1. Get-MailboxGet-Mailbox
2.2. Read-MailboxRead-Mailbox
3.3. Get-UserGet-User
4.4. Get-MailuserGet-Mailuser
Review: Introduction to Windows Review: Introduction to Windows PowerShellPowerShell
Which CMDLET sorts rows of output from a Which CMDLET sorts rows of output from a
PowerShell command?PowerShell command?
1.1. Sort-ObjectsSort-Objects
2.2. Sort-ObjectSort-Object
3.3. Sort-BySort-By
4.4. Sort-RowSort-Row
Review: Introduction to Windows Review: Introduction to Windows PowerShellPowerShell
What is the default execution policy for the What is the default execution policy for the
Exchange Server Administration Shell?Exchange Server Administration Shell?
1.1. RestrictedRestricted
2.2. RemoteSignedRemoteSigned
3.3. UnrestrictedUnrestricted
4.4. AllSignedAllSigned
Review: Introduction to Windows Review: Introduction to Windows PowerShellPowerShell
What character indicates a user-defined What character indicates a user-defined
variable in Windows PowerShell?variable in Windows PowerShell?
1.1. $$
2.2. ##
3.3. @@
4.4. %%
Review: Introduction to Windows Review: Introduction to Windows PowerShellPowerShell
Which CMDLET changes the execution Which CMDLET changes the execution
policy in PowerShell?policy in PowerShell?
1.1. Get-ExecutionPolicyGet-ExecutionPolicy
2.2. Alter-ExecutionPolicyAlter-ExecutionPolicy
3.3. Set-ExecutionPolicySet-ExecutionPolicy
4.4. New-ExecutionPolicyNew-ExecutionPolicy
AgendaAgenda
• ReviewReview
• Managing Exchange Server with Windows Managing Exchange Server with Windows PowerShellPowerShell
• Windows PowerShell ScriptingWindows PowerShell Scripting
Exchange Server Management Exchange Server Management ModelModel
Monad Engine
Exchange cmdlets
Configuration Data Access
Early-bound objs
Windows Forms
ADO.Net
Monad Data Provider
Windows Forms
CLI
Setup
MAPI Registry Active Directory® Metabase
Programmatic Bulk ChangesProgrammatic Bulk Changes
• Results of a task can be Results of a task can be used as a parameter to used as a parameter to another taskanother task
Get-user | enable-mailboxGet-user | enable-mailbox
• Looping can result in bulk Looping can result in bulk creation of objectscreation of objects
$users = get-user | $users = get-user | foreach ($user in $users)foreach ($user in $users)
{ Enable-mailbox –{ Enable-mailbox –database: “EXBE01\database: “EXBE01\
Mailbox Store”}Mailbox Store”}
WhatifWhatif
get-mailbox |
where-object {$_.servername -eq “sea-exc-01"} |
move-mailbox –targetdatabase
“sea-exc-01\Mailbox Database" -whatif
Using Windows PowerShell to Manage Using Windows PowerShell to Manage MicrosoftMicrosoft®® Exchange Server 2007 Exchange Server 2007
Manage mailboxesManage mailboxes Manage distribution groupsManage distribution groups Manage public foldersManage public folders
demonstrationdemonstration
Managing Exchange Server with Managing Exchange Server with Windows PowerShellWindows PowerShell
Which command will create a new Which command will create a new
distribution group?distribution group?
1.1. Create-DistributionGroupCreate-DistributionGroup
2.2. Add-DistributionGroupAdd-DistributionGroup
3.3. New-DistributionGroupNew-DistributionGroup
4.4. New-ExDistributionGroupNew-ExDistributionGroup
Managing Exchange Server with Managing Exchange Server with Windows PowerShellWindows PowerShell
Which bulk operations can be performed inWhich bulk operations can be performed in
Windows PowerShell?Windows PowerShell?
1.1. Mail-enable mailboxesMail-enable mailboxes
2.2. Set mailbox quotasSet mailbox quotas
3.3. Get mailbox permissionsGet mailbox permissions
4.4. All of the aboveAll of the above
Managing Exchange Server with Managing Exchange Server with Windows PowerShellWindows PowerShell
How do you get information about a public How do you get information about a public
folder?folder?
1.1. Read-PublicFolderRead-PublicFolder
2.2. Get-FolderInfoGet-FolderInfo
3.3. Set-PublicFolderSet-PublicFolder
4.4. Get-PublicFolderGet-PublicFolder
AgendaAgenda
• ReviewReview
• Managing Exchange Server with Windows Managing Exchange Server with Windows PowerShellPowerShell
• Windows PowerShell ScriptingWindows PowerShell Scripting
Formatting OutputFormatting Output
Sort ObjectsSort Objectssort-object name, aliassort-object name, alias
Format TableFormat Tableformat-table name, aliasformat-table name, alias
Format ListFormat Listformat-list name, aliasformat-list name, alias
Reporting in the ShellReporting in the Shell
• All managed objects in Exchange Server can be exported to .CSV file
• Task results can be viewed in multiple formats
• Robust test harness for service health, system health, rules
.CSV
Community ResourcesCommunity Resources
• Newsgroup: Microsoft.Public.Windows.PowerShell• Channel 9 tag:
– http://channel9.msdn.com/tags/Monad
• Team blog: – http://blogs.msdn.com/PowerShell/
• OMark van Orsouw’s blog: – http://mow001.blogspot.com
• Wiki:– http://channel9.msdn.com/wiki/default.aspx/Channel9.WindowsPowerShellWiki
• Script Center:– www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
• O’Reilly book – Monad: Introducing the MSH Command Shell and Language – www.oreilly.com/catalog/msh/
• Manning Press book by Bruce Payette: PowerShell in Action – http://manning.com/powershell/
• Sapien Press book by Don Jones: PowerShell– www.sapienpress.com/
• MshAnalyzer tool– www.karlprosser.com/coder/?cat=8
Using Windows PowerShell Scripts to Manage Exchange Server
Use scripts for reporting logonsUse scripts for reporting logons Use scripts for mailbox reportingUse scripts for mailbox reporting Use scripts to create mailboxesUse scripts to create mailboxes
demonstrationdemonstration
Windows PowerShell ScriptingWindows PowerShell Scripting
Which Windows PowerShell command getsWhich Windows PowerShell command gets
keyboard input?keyboard input?
1.1. Read-HostRead-Host
2.2. Read-InputRead-Input
3.3. Get-InputGet-Input
4.4. Get-KeyboardGet-Keyboard
PowerShell ScriptingPowerShell Scripting
To include a password as part of a script, To include a password as part of a script,
which data type must be used?which data type must be used?
1.1. StringString
2.2. Password Password
3.3. CryptedStringCryptedString
4.4. SecureStringSecureString
PowerShell ScriptingPowerShell Scripting
Which of the following output formatsWhich of the following output formatscan Windows PowerShell produce?can Windows PowerShell produce?
1.1. HTMLHTML2.2. XMLXML3.3. CSVCSV4.4. All of the aboveAll of the above
Session SummarySession Summary
• Manage all aspects of Exchange ServerManage all aspects of Exchange Server
• Fast, reusable automationFast, reusable automation
• Flexible reportingFlexible reporting
Questions and AnswersQuestions and Answers
• Submit text questions using the “Ask” button. Submit text questions using the “Ask” button. • Don’t forget to fill out the survey.Don’t forget to fill out the survey.• For upcoming and previously live webcasts: For upcoming and previously live webcasts:
www.microsoft.com/webcastswww.microsoft.com/webcasts
• Got webcast content ideas? Contact us at: Got webcast content ideas? Contact us at: http://go.microsoft.com/fwlink/?LinkId=41781http://go.microsoft.com/fwlink/?LinkId=41781
• Today's webcast was presented using MicrosoftToday's webcast was presented using Microsoft®® Office Live Meeting. Get a free 14-day trial by Office Live Meeting. Get a free 14-day trial by visiting: visiting: www.microsoft.com/presentlivewww.microsoft.com/presentlive