My Blog List

Tuesday, July 26, 2022

Exchange

 



#List DL details  

Get-DistributionGroupMember -Identity BA-EV_Journaling@testdomain.com | Select DisplayName, samAccountname, RecipientTypeDetails | Export-Csv -Path C:\Temp\BA-EV_journal.csv


#Add multiple users to exchange DL using .csv(name = email)

Import-CSV FileName.csv | ForEach {Add-DistributionGroupMember -Identity "GROUP-NAME" -Member $_.Name}


#View the move history for a mailbox using Get-MailboxStatistics and the -IncludeMoveHistory switch

(Get-MailboxStatistics alan.reid -IncludeMoveHistory).MoveHistory | select CompletionTimestamp,SourceDatabase,TargetDatabase | ft -auto


#Find ExchangeDB of a mailbox

Get-Mailbox -Identity MelbourneLending | select name, database


get-mailbox -ResultSize unlimited | where {$_.emailaddresses -like "*testdomain.com"} | Select name, primarysmtpaddress, Emailaddresses | Export-Csv C:\Temp\emailaliases.csv


#Get mailbox details from email address

Import-CSV C:\sj\emails.csv | foreach {Get-Mailbox -Identity $_.Email} | Select Name, RecipientTypeDetails,enabled | Export-Csv -Path C:\Temp\Emails.csv -NTI


Get-ThrottlingPolicy -Identity ATFSPolicy | fl


#Use powershell on the on-premise Exchange:

Remove-remotemailbox –identity testdelt@domain.com


#create new shared mailbox

New-RemoteMailbox -Shared -Name "BA SQL Prod Alerts" -Firstname "BA SQL" -LastName "Prod Alerts" -UserPrincipalName "BASql.ProdAlerts@testdomain.com" -OnPremisesOrganizationalUnit "OU=Shared,OU=Resources,OU=Production,DC=members,DC=com"


#create new mailbox

New-RemoteMailbox -Name "IT SDPDEV" -Firstname "IT" -LastName "SDPDEV" -UserPrincipalName "IT.SDPDEV@testdomain.com" -OnPremisesOrganizationalUnit "OU=Fullmbx,OU=Resources,OU=Production,DC=members,DC=com"


#get recently created mailboxes

Get-Mailbox | Where-Object {$_.WhenCreated –ge ((Get-Date).Adddays(-14))}


#book a meeting room for an invite that has been sent to me

Get-Mailbox "ourroom" | Get-CalendarProcessing |select ProcessExternalMeetingMessages

ProcessExternalMeetingMessages

------------------------------

False

PS> Get-Mailbox "ourroom" | Set-CalendarProcessing -ProcessExternalMeetingMessages $True

PS> Get-Mailbox "ourroom" | Get-CalendarProcessing |select ProcessExternalMeetingMessages

ProcessExternalMeetingMessages

------------------------------

True

#How to Add Remote IP Addresses to Existing Receive Connector

To add a single IP address to an existing Receive Connector:

[PS] C:\>$RecvConn = Get-ReceiveConnector "Relay Connector"
[PS] C:\>$RecvConn.RemoteIPRanges += "10.0.0.99"
[PS] C:\>Set-ReceiveConnector "Relay Connector" -RemoteIPRanges $RecvConn.RemoteIPRanges

Now we can see that 10.0.0.99 has been added to the Receive Connector.

[PS] C:\>Get-ReceiveConnector "Relay Connector" | fl remoteipranges

RemoteIPRanges : {10.0.0.99, 10.0.0.23, 10.0.0.22, 10.0.0.21, 10.0.0.1, 10.0.0.2, 10.0.0.3, 10.0.0.11, 10.0.0.12, 10.0.
                 0.13, 10.0.0.4, 10.0.0.5, 10.0.0.6, 10.0.0.7, 10.0.0.8, 10.0.0.9, 10.0.0.10, 10.0.0.15, 10.0.0.16, 10.
                 0.0.17, 10.0.0.18, 10.0.0.19, 10.0.0.20, 10.0.0.14}

To add multiple IP addresses at once use this command sequence:

[PS] C:\>$RecvConn = Get-ReceiveConnector "Relay Connector"
[PS] C:\>$RecvConn.RemoteIPRanges += "10.0.0.99", "10.0.0.100", "10.0.0.101"
[PS] C:\>Set-ReceiveConnector "Relay Connector" -RemoteIPRanges $RecvConn.RemoteIPRanges

Sometimes the list of IPs being added is too long to type out. To add multiple IP addresses from a text file called newips.txt use this command sequence instead:

[PS] C:\>$RecvConn = Get-ReceiveConnector "Relay Connector"
[PS] C:\>Get-Content .\newips.txt | foreach {$RecvConn.RemoteIPRanges += "$_"}
[PS] C:\>Set-ReceiveConnector "Relay Connector" -RemoteIPRanges $RecvConn.RemoteIPRanges

No comments:

Post a Comment

Steps to extract ntfs share details from file server shares

As part of a file server consolidation effort, I was tasked to come up with a method to move multiple shares on multiple shares to a WSFC. I...