CMDlets Flashcards
Create eDiscovery mailbox
New-MailboxSearchResults –Discovery –UserPrincipalName SearchResults@CBTNuggets.com
Sets OWA Mailbox policy to allow .pdf files
Set-OWAMailboxPolicy –Identity Default –AllowedFileTypes ‘.pdf’
Retrieve list of devices in organization using Exchange Active Sync
Set-OWAMailboxPolicy –Identity Default –AllowedFileTypes ‘.pdf’
Enable in-place archiving
Enable-Mailbox “User Name” – Archive
Check mailboxes enabled for archiving
Get-Mailbox –Archive –ResultSize Unlimited
Disable in-place archive
Disable-Mailbox –Identity “User Name” –Archive
(1) Retrieve GUID, (2) then connect disabled archive to mailbox user by replacing GUID with one retrieved in (1)
(1) Get-MailboxDatabase | Get-MailboxStatistics-Filter ‘DisconnectDate –ne $null’
(2) Connect-Mailbox Identity “8734c04e-981e-4ccf-a547-1c1ac7ebf3e2” –Archive –User “User Name”
Connect to your Exchange Online service
Connect-MSolService
(1)Create and (2)change a retention policy
(1) New-RetentionPolicy -RetentionPolicyTagLinks
(2) Set-MailBox “Mailbox Name” –RetentionPolicy “Retention Policy Name”
Change old retention policy to new one
$OldPolicy={Get-RetentionPolicy “Old-Retention-Policy”}.distinguishedName
Get-Mailbox -Filter {RetentionPolicy -eq $OldPolicy} -Resultsize Unlimited | Set-Mailbox -RetentionPolicy “New-Retention-Policy”
Test whether mailbox policy was applied
Get-Mailbox “Mailbox Name” | Select RetentionPolicy
Create additional discovery mailbox
New-MailBox SearchResults -Discovery –PrimarySmtpAddress Searchresults@cbtnuggets.com
Display available discovery mailboxes
Get-Mailbox -Resultsize unlimited -Filter {RecipientTypeDetails -eq “DiscoveryMailbox”}
Create In-place hold
New-MailBoxSearch “Search Name” –SourceMailboxes Kengle@cbtnuggets.com –InPlaceHoldEnabled $true
Create new malware filter
New-MalwareFilterPolicy -Name “CBT Nuggets Defense System” -EnableInternalSenderAdminNotifications $true –InternalSenderAdminAddress admin@cbtnuggets346.onmicrosoft.com
Configure existing malware filter
Set-MalwareFilterPolicy –Identity “CBT Nuggets Defense System”
Connect to your Exchange Online service
Connect-MSolService –Credentials $Credentials
Configure additional proxy addresses
$users = Get-Mailbox foreach ($a in $users) {$a.emailaddresses.Add(“smtp:$($a.alias)@thenewdomainname”)}
$users | %{Set-Mailbox $.Identity -EmailAddresses $.EmailAddresses}
Configure additional addresses using .csv file
Import-CSV “C:\Users\Administrator\Desktop\AddEmailAddress.csv” | ForEach {Set-Mailbox
$.Mailbox -EmailAddresses @{add=$.NewEmailAddress}}
Create contacts using PowerShell with a .csv file
Import-Csv .\ExternalContacts.csv|%{New-MailContact -Name $.Name -DisplayName $.Name -
ExternalEmailAddress $.ExternalEmailAddress -FirstName $.FirstName -LastName $_.LastName}
Add more information to each existing contact using .csv file
(1) $Contacts = Import-CSV .\externalcontacts.csv
(2) $contacts | ForEach {Set-Contact $.Name -StreetAddress $.StreetAddress -City $.City -
StateorProvince $.StateorProvince -PostalCode $.PostalCode -Phone $.Phone -MobilePhone
$.MobilePhone -Pager $.Pager -HomePhone $.HomePhone -Company $.Company -Title
$.Title -OtherTelephone $.OtherTelephone -Department $.Department -Fax $.Fax -Initials
$.Initials -Notes $.Notes -Office $.Office -Manager $.Manager}
Hide contacts using PowerShell
Set-MailContact HiddenFromAddressListsEnabled $true
Get-Contact -ResultSize unlimited -Filter {(RecipientTypeDetails -eq ‘MailContact’)} | Set-MailContact -HiddenFromAddressListsEnabled $true
Create and configure a mail user using PowerShell
New-MailUser -Name -WindowsLiveID -Password (ConvertTo-SecureString -String ‘’ -AsPlainText -Force)
Set-MailUser LindaAdams-ExternalEmailAddress LindaAdams@cbtnuggets.org
Create and configure a shared mailbox using PowerShell
New-Mailbox -Name “CBT Nuggets Trainers” -Alias CBTNTrainers –Shared
Set-Mailbox CBTNTrainers -ProhibitSendReceiveQuota 5GB -ProhibitSendQuota 4.75GB -IssueWarningQuota 4.5GB
Manage Mailbox permissions using PowerShell
Remove-MailboxPermission -Identity -User -AccessRights FullAccess
Add-MailboxPermission -Identity Kengle -User ‘Kurt Engle’ -AccessRight FullAccess -
InheritanceType All -Automapping $false
Create and configure a room mailbox user using PowerShell
New-Mailbox -Name “Second Floor Back Patio” –Room
Set-CalendarProcessing -AutomateProcessing AutoAccept
Create and configure an equipment mailbox using PowerShell
New-Mailbox -Name “Trainer Laptop – Tag BR549” –Equipment
Set-CalendarProcessing -AutomateProcessing AutoAccept
Change Mailbox type
Set-Mailbox -Type Regular
Get-Mailbox -Identity | Format-List RecipientTypeDetails
Create and view a mail-enable security group using PowerShell
New-DistributionGroup -Name “CBT Nuggets Trainers” -Alias CBTNTrainers -Type security
Get-DistributionGroup CBTNTrainers | FL Name,RecipientTypeDetails,PrimarySmtpAddress
Create a mail-enable distribution group using PowerShell
New-DistributionGroup -Name “CBTN Managers” -Alias CBTNMngrs –MemberJoinRestriction Open
Create and view a dynamic distribution group using PowerShell
New-DynamicDistributionGroup -IncludedRecipients MailboxUsers -Name “CBTN Marketing Dynamic Group” -Department Marketing
Get-DynamicDistributionGroup -Identity “Marketing” | Format-List
Connect to your SharePoint Online service using PowerShell
Connect-SPOService -Url https://cbtnuggets346-admin.sharepoint.com –credential brianalderman@cbtnuggets346.onmicrosoft.com
Retreive list of available site templates using PowerShell
Get-SPOWebTemplate
Create new site collection using PowerShell
New-SPOSite –Url https://cbtnuggets346.sharepoint.com/teams/HR –Owner Engle@cbtnuggets346.onmicrosoft.com –Template “STS#0” -Title “HR Site”
Retrieve information about site collection using PowerShell
Get-SPOSite or Get-SPOSite –Identity SiteCollectionUrl
Configure site collection settings using PowerShell
Set-SPOSite –Identity https://cbtnuggets346.sharepoint.com/teams/HR –StorageQuota 750 -StorageQuotaWarningLevel 500
Delete or restore a site collection using PowerShell
Remove-SPOSite -Identity https://cbtnuggets346.sharepoint.com/teams/HR -NoWait
Restore-SPODeletedSite -Identity https://cbtnuggets.sharepoint.com/teams/HR -NoWait
Enable or Disable push notifications using PowerShell
Set-CsPushNotificationConfiguration EnableApplePushNotificationService or EnableMicrosoftPushNotificationService
Retrieve information about Lync Online users using PowerShell
Get-CsOnlineUser
Assign audio conference number to a user using PowerShell
Set-CSUserAcp -TollNumber, -TollFreeNumbers, -ParticipantPassCode
Retrieve information about Lync Tenant using PowerShell
Get-CsTenant
Enable or disable ability to record online conferences using PowerShell
Set-CsMeetingConfiguration –AllowConferenceRecording
Retrieve list of blocked domains from blocked domains list using PowerShell
Get-CsTenantFederationConfiguration
Enable or disable federation with public IM providers using PowerShell
Set-CsTenantFederationConfiguration –AllowPublicUsers
Enable mailbox auditing for a specific user using PowerShell
Set-Mailbox user@domainname.com -AuditEnabled $true
Enable mailbox auditing for all users using PowerShell
$UserMailboxes = Get-mailbox -Filter {(RecipientTypeDetails -eq ‘UserMailbox’)}
$UserMailboxes | ForEach {Set-Mailbox $_.Identity -AuditEnabled $true}
View configuration settings for current administrator audit logging
Get-AdminAuditLogConfig
Add comments to administrator audit log
Write-AdminAuditLog
Search content of administrator audit log
Search-AdminAuditLog or New-AdminAuditLogSearch
View accounts that bypass mailbox audit logging
Get-MailboxAuditBypassAssociation
Specify accounts that bypass mailbox audit logging
Set-MailboxAuditBypassAssociation
Retrieve data from a specific message tracking report
Get-MessageTrackingReport
Find unique message tracking report using search criteria provided
Search-MessageTrackingReport
View information about open logon sessions to specified mailbox
Get-LogonStatistics
View information about the folders in a specified mailbox
Get-MailboxFolderStatistics
View information about a specified mailbox
Get-MailboxStatistics
View information about total number of recipients in organization
Get-RecipientStatisticsReport