Get-transportserver | get-queue | ? {$_.messagecount -gt 5}
(If you need to check the queue in just a specific region, where the (transport) server identity of each region starts with the initials of each country ie: server names are HKexch1, HKexch2, HKExch3)
eg:
get-transportserver HK* | get-queue
get-transportserver SNG* | get-queue
get-transportserver LDN* | get-queue
get-transportserver Switz* | get-queue
get-transportserver Dubai* | get-queue
Finding which CAS you are connected to:
Get-LogonStatistics -Identity jsmith | Sort-Object "LastAccessTime" | ft username, clientname, *last*
Get-LogonStatistics -Server Mailboxservername |ft username, clientname
Get-distributionGroup -resultsize unlimited| where {$_.name -like "HR_*" -or $_.name -like "ib*"}|set-distributiongroup -ManagedBy user@domain.com, user2@domain, user3@domain.com, user4@domain.com
Get-DistributionGroup project* | set-distributiongroup -ManagedBy user@domain.com, user2@domain.com, user3@domain.com
get-queue | ? {$_.messagecount -gt 1} | retry-queue -resubmit:$true
get-queue | ? {$_.DeliveryType -ne 'ShadowRedundancy' -AND $_.Status -eq 'Retry'} | retry-queue -resubmit:$true
How to view all accounts in the forest
Set-AdServerSettings -ViewEntireForest $true
Content index State
Get-MailboxDatabaseCopyStatus -Server <servername> | ?{$_.contentindexstate -eq “failed"}
Get-MailboxDatabaseCopyStatus –Server <servername> | ? {$_.contentindexstate -eq “failed"} | update-mailboxdatabasecopy –catalogonly
Rebalance DB’s:
.\RedistributeActiveDatabases.ps1 -DagName DAG1 -BalanceDbsByActivationPreference –Confirm:$false -ShowFinalDatabaseDistribution
Get db's with failed conent index state:
Get-MailboxDatabase | ? {$_.ReplicationType -eq 'Remote'} | Get-MailboxDatabaseCopyStatus | ? {$_.ContentIndexState -ne 'Healthy'}
Repair DB’s with failed Content Index State:
Get-MailboxDatabaseCopyStatus * | where {$_.ContentIndexState -eq "Failed"} | Update-MailboxDatabaseCopy -CatalogOnly
Get number of mailboxes:
(Get-MailboxDatabase) | ForEach-Object {Write-Host $_.Name (Get-Mailbox -Database $_.Name).Count}
(Get-MailboxDatabase) | Select-Object Name,@{Name="Number of users";Expression={(Get-Mailbox -Database $_.name).Count}}
get-mailbox -resultsize unlimited | group-object -property Database -noelement
Get smallest DB:
Get-MailboxDatabase | Select-Object Name,@{Name=”Count”;Expression={Get-MDBMailboxCount -DN $_.DistinguishedName}} | Sort-Object count | Select-Object -First 1
FIND EMAIL FROM USER:
$sender = '<user>@<company>.com'
$time = '10/17/2011 9:00AM'
$ts = Get-TransportServer EXJSQ* | ? {-NOT $_.Name.Contains("EDGE")}
$ts | Get-MessageTrackingLog -SEnder $sender -Start $time -recipient <anotheruser>@<anothercompany>.com
Message tracking:
Get-transportserver | ? {-NOT $_.Name.Contains("EDGE")} | Get-MessageTrackinglog -ResultSize unlimited -Sender user@domain.com -MessageSubject "SUBJECT" -Start "MM/DD/YYYY HH:MMPM" | Select Sender, @ {N="Recipients";E={$_.Recipients}}, MessageSubject, MessageID, RecipientCount, RelatedRecipientAddress, Client*, Server*,EventID,Time* | Export-CSV -Encoding "ASCII" C:\users\<username>\desktop\new_MSG-TrackingResult.csv –Notype
Exchange Tests (need extest account):
Test-ActiveSyncConnectivity
Test-EcpConnectivity
Test-EdgeSynchronization
Test-EdgeSyncMserv
Test-ExchangeSearch
Test-FederationTrustCertificate
Test-ImapConnectivity
Test-IPAllowListProvider
Test-IPBlockListProvider
Test-Mailflow -v >> C:\test\Report\Test-Mailflow.txt
Test-MapiConnectivity -v >> C:\test\Report\Test-MapiConnectivity.txt
Test-Message
Test-OutlookWebServices -v >> C:\test\Report\Test-OutlookWebServices.txt
Test-OwaConnectivity
Test-PopConnectivity
Test-PowerShellConnectivity
Test-ReplicationHealth -v >> C:\test\Report\Test-ReplicationHealth.txt
Test-SenderId
Test-ServiceHealth -v >> C:\test\Report\Test-ServiceHealth.txt
Test-SystemHealth
Test-UMConnectivity
Test-WebServicesConnectivity
Assign impersonation rights:
New-ManagementRoleAssignment –Name:impersonationAssignmentName –Role:ApplicationImpersonation –User:serviceAccount
New-ManagementRoleAssignment –Name:ApplicationImpersonation –Role:ApplicationImpersonation –User:svc_<applicationname>
ALL scripts:
Cd\
Mkdir C:\test\
Mkdir C:\test\Report\
ipconfig /all >> C:\test\Report\ipconfigall.txt
netsh int tcp show global >> C:\test\Report\Chimney.txt
cluster /prop >> C:\test\Report\ClusterProperties.txt
Get-ExecutionPolicy >> C:\test\Report\ExecutionPolicy.txt
Get-ClientAccessArray >> C:\test\Report\Get-ClientAccessArray.txt
Get-ClientAccessArray | fl >> C:\test\Report\Get-ClientAccessArrayFL.txt
Get-ClientAccessServer >> C:\test\Report\Get-ClientAccessServer.txt
Get-ClientAccessServer | fl >> C:\test\Report\Get-ClientAccessServerFL.txt
Get-ClientAccessServer | fl name,*uri* >>C:\test\Report\Get-ClientAccessServerURL.txt
Get-MailboxDatabase >> C:\test\Report\Get-MailboxDatabase.txt
Get-MailboxDatabase | fl >> C:\test\Report\Get-MailboxDatabaseFL.txt
Get-MailboxDatabase | fl rpc* >> C:\test\Report\Get-MailboxDatabase-RPC.txt
Get-MailboxDatabase | fl Name,*path*,*rpc*,*lag* >> C:\test\Report\Get-MailboxDBNamePath.txt
Get-MailboxDatabaseCopyStatus * >> C:\test\Report\Get-MailboxDatabaseCopyStatus.txt
Get-MailboxDatabaseCopyStatus * -ConnectionStatus | fl Name,OutGoingConnections,IncomingLogCopyingNetwork >> C:\test\Report\Get-MailboxDBReplicationNetwork.txt
Get-Mailbox -Arbitration >> C:\test\Report\Get-MailboxArbitration.txt
Get-Mailbox -Arbitration | fl >> C:\test\Report\Get-MailboxArbitrationFL.txt
Get-CASMailbox -Filter {hasactivesyncdevicepartnership -eq $true -and -not displayname -like "CAS_{*"} | Get-Mailbox | FL Name >> C:\test\Report\ActiveSyncDevices.txt
Get-DatabaseAvailabilityGroup >> C:\test\Report\Get-DatabaseAvailabilityGroup.txt
Get-DatabaseAvailabilityGroup | fl >> C:\test\Report\Get-DatabaseAvailabilityGroupFL.txt
Get-DatabaseAvailabilityGroup -Status | fl >> C:\test\Report\Get-DatabaseAvailabilityGroupStatus.txt
Get-DatabaseAvailabilityGroup | fl Name,*rpc* >> C:\test\Report\Get-DatabaseAvailabilityGroupRPC.txt
Get-DatabaseAvailabilityGroupNetwork >> C:\test\Report\Get-DatabaseAvailabilityGroupNetwork.txt
Get-DatabaseAvailabilityGroupNetwork | fl >> C:\test\Report\Get-DatabaseAvailabilityGroupNetworkFL.txt
Get-SendConnector >> C:\test\Report\Get-SendConnector.txt
Get-SendConnector | fl >> C:\test\Report\Get-SendConnectorFL.txt
Get-ReceiveConnector >> C:\test\Report\Get-ReceiveConnector.txt
Get-ReceiveConnector | fl >> C:\test\Report\Get-ReceiveConnectorFL.txt
Get-TransportConfig >> C:\test\Report\Get-TransportConfig.txt
Get-TransportConfig | fl >> C:\test\Report\Get-TransportConfigFL.txt
Get-TransportServer >> C:\test\Report\Get-TransportServer.txt
Get-TransportServer | fl >> C:\test\Report\Get-TransportServerFL.txt
Get-Queue >> C:\test\Report\Get-Queue.txt
Get-Queue | fl >> C:\test\Report\Get-QueueFL.txt
Get-RoutingGroupConnector >> C:\test\Report\Get-RoutingGroupConnector.txt
Get-RoutingGroupConnector | fl >> C:\test\Report\Get-RoutingGroupConnectorFL.txt
Get-PublicFolderStatistics -ResultSize unlimited | Export-Csv C:\test\Report\PFStats.txt
Get-PublicFolderDatabase | fl Name,*path*,*rpc* >> C:\test\Report\PubFolderDBNamePath.txt
Get-ExchangeServer | fl Name,ServerRole,Edition,AdminDisplayVersion >> C:\test\Report\ExVersions.txt
Get-ExchangeServer | fl >> C:\test\Report\ExchangeServerFL.txt
Get-RetentionPolicy >> C:\test\Report\retentionpolicy.txt
Get-RetentionPolicy | fl Name,RetentionPolicyTagLinks >> C:\test\Report\retentionpolicytaglinks.txt
get-adsite | fl * > c:\test\report\get-adsite.txt
get-adsitelink | fl* > c:\test\report\get-adsitelink.txt
Get-Organizationconfig | fl * > c:\test\report\get-organizationconfig.txt
Get-ADDomaincontroller | fl * > c:\test\report\get-addomaincontroller.txt
Exchange 2016
.\Report-MailboxPermissions.ps1 -HTMLReport C:\Temp\ALL.html
Office 365
https://o365reports.com/2020/03/16/powershell-free-office-365-reporting-tool/
No comments:
Post a Comment