## Demo of PowerShell start-transcript get-commands - use tab completion - show organisation using PowerShell Assistant Get-Help Get-Command - explain about -full & -detailed help get-command man get-command (pages) - show same in PSA get-aliases get-childitem -- use c:\scripts dir ls adminsitrative cmdlets get-service - just show more later get-process get-process | select name, cpu | Format-Table -auto get-process | select name, cpu | sort cpu -desc | select -first 10 | Format-Table -auto get-service_web.ps1 get-eventlog -list get-timedevents.ps1 - - - - - change the dates !!!! cd hklm: ###powergadgets Top5LargestProcessMemorywise.ps1 AvailableMemoryMegaBytes.ps1 ServerMap.ps1 stop-transcript ################################################# ## Demo of range of Exchange cmdlets Show the nouns.txt file Note the range of cmdlets & the tasks covered Pick out specifics - AddressList - ADSite - Distribution Group - Global Address List - Group - Mailboxes, databases, storage groups - users & contacts - POP & IMAP - Public Folders - Testing - Unified Messaging -etc ################################################# ##EMS - how to protect yourself start-transcript get-service ## need to select exchange services get-service msexch* ## can pipeline to stop get-service msexch* | stop-service -whatif ## administer storage groups etc get-storagegroup new-storagegroup London1 get-storagegroup get-mailboxdatabase new-mailboxdatabase Soho -storagegroup London1 get-mailboxdatabase mount-database soho ########## users ###Create Mailbox. - -- NB the password MUST be a secure string $password = Read-Host "Password" -assecurestring Password: ********* new-mailbox -database Soho -Name "Joe Bloggs" -OrganizationalUnit Reporters -Password $password -UserPrincipalName joebloggs@psuguk.org -DisplayName "Joe Bloggs" -FirstName Joe -LastName Bloggs -ResetPasswordOnNextLogon $true -SamAccountName jbloggs ###Mail Enable a user object. ### use New-MailUser to create a new mail enabled user ### the user is already created Enable-MailUser -Identity "Rep Orter" -ExternalEmailAddress reporter@sleazyrag.com ### Mailbox Enable a user object. ### Note Corrie spondent already exists Enable-Mailbox -Database Soho -Identity "Corrie Spondent" ### Mailbox Disable a user object Disable-Mailbox -Identity "Corrie Spondent" ### Mail Disable a use object Disable-MailUser "Rep Orter" ## add email address set-mailbox "Achille Occhetto" -EmailAddresses ((get-Mailbox "Achille Occhetto").EmailAddresses + "achille@dodgygeezer.com") ## add to distribution group Add-DistributionGroupMember Budgets -Member "Achille Occhetto" get-mailboxdatabase "Members" | select *quota set-MailboxDatabase "Members" -ProhibitSendReceiveQuota 60MB -ProhibitSendQuota 50MB -IssueWarningQuota 40MB ############ Reporting ## server info get-exchangeserver | format-list ## service health test-servicehealth ## connectivity - CAS = client access server - Sarunas Birutis is OWA disabled - show in GUI get-mailbox | get-casmailbox | where{!$_.owaenabled} ## Reporting Mailbox sizes Get-MailboxStatistics |Where {$_.Displayname -notlike "SystemMail*"} |select DisplayName, ItemCount, TotalItemSize, StorageLimitStatus | sort itemcount -desc | select -first 15|format-table DisplayName, ItemCount, @{Label="Approx Size (MB)"; Expression={[int](($_.totalitemsize.ToString().Replace("B", ""))/1mb)}}, StorageLimitStatus -autosize Get-MailboxStatistics |Where {$_.Displayname -notlike "SystemMail*"} | sort itemcount -desc | select -first 5 | Move-Mailbox -TargetDatabase "Mailbox Database" REMEMBER TO SHOW SCRIPT GENERATED IN GUI