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