Showing posts with label Exchange 2010. Show all posts
Showing posts with label Exchange 2010. Show all posts

Saturday, January 12, 2019

[EX16] Script to send test message with attachment


Add-PSSnapin Microsoft.Exchange.Management.Powershell.Admin -erroraction silentlyContinue
$file = "C:\Users\admin\Desktop\f2.zip"
get-mailbox -organizationalunit "formula one" | % {Send-MailMessage -SmtpServer exhub.domain.int -To $_.primarysmtpaddress -From senna@domain.com -Subject “SUBJECT HERE” -Body “BODY HERE” -attachment $file}

Monday, August 6, 2018

[EX10] Check Send-As Permissions



Finding all users who have Send-As :

Get-Mailbox -Resultsize Unlimited | Get-ADPermission | ? {($_.ExtendedRights -like "*send-as*") -and -not
($_.User -like "nt authorityself")} | ft Identity, User -auto

Find out who a particular user can Send-As:

Get-Mailbox -Resultsize Unlimited | Get-ADPermission | ? {($_.ExtendedRights -like "*send-as*") -and -not
($_.User -like "nt authorityself") -and ($_.User -like "DOMAINUsernameUwantToFind")} | ft Identity, User -auto

Find all users who have Full Access to the mailbox of others:

Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission | ? {($_.AccessRights -match "FullAccess") -and 
not ($_.User -like "NT AUTHORITYSELF")} | ft Identity, User

Add Full Access without Auto-Mapping:

Add-MailboxPermission -Identity JeroenC -User 'Mark Steele' -AccessRight FullAccess -InheritanceType All -Automapping $false


"This example removes auto-mapping on an existing shared mailbox and removes the auto-mapping behavior for users who have already been granted Full Access permissions."

$FixAutoMapping = Get-MailboxPermission sharedmailbox |where {$_.AccessRights -eq "FullAccess" -and $_.IsInherited -eq $false}
$FixAutoMapping | Remove-MailboxPermission
$FixAutoMapping | ForEach {Add-MailboxPermission -Identity $_.Identity -User $_.User -AccessRights:FullAccess -AutoMapping $false}

Sunday, July 23, 2017

[EX2013] Deploy MaxConcurrentApi



# deploy MaxConcurrentApi key in multiple Exchange servers
Get-Exchangeserver | foreach{Invoke-Command -ComputerName $_.fqdn -ScriptBlock {
    $registryPath = "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters"
    $Name = "MaxConcurrentApi"
    $value = "10"

    IF(!(Test-Path $registryPath)){
        New-Item -Path $registryPath -Force | Out-Null
        New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null}
    ELSE {
        New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null}

    restart-service netlogon -Force
}}

# deploy MaxConcurrentApi key in multiple DC servers. This is captured from the “currentDomainControllers” result.
(Get-Exchangeserver servername -Status).CurrentDomainControllers | foreach{Invoke-Command -ComputerName $_ -ScriptBlock {
    $registryPath = "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters"
    $Name = "MaxConcurrentApi"
    $value = "10"

    IF(!(Test-Path $registryPath)){
        New-Item -Path $registryPath -Force | Out-Null
        New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null}
    ELSE {
        New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null}

    restart-service netlogon -Force
}}

Wednesday, March 1, 2017

[EX2013] Default folder is missing



Use the steps below to confirm that you are facing this issue, and to reset the PR_ATTR_HIDDEN property of the affected folder.

  1. Download and extract the MFCMAPI tool from http://mfcmapi.codeplex.com.
  2. Launch mfcmapi.exe and click OK through the intro screen.
  3. On the Session menu, click Logon.
  4. Select the Outlook profile for the affected mailbox, and click OK.
  5. Double-click the email address which represents the desired mailbox.
  6. In the left pane, navigate to the affected folder using the appropriate steps below for the type of Outlook profile you are using.

    Cached Mode
    1. Expand Root - Mailbox
    2. Expand IPM_SUBTREE


    Online Mode

    1. Expand Root Container
    2. Expand Top of information Store
  7. Locate and select the folder that appears missing in Outlook, and check the value of the PR_ATTR_HIDDEN to determine if it is set to True, as shown in the following figure:


  8. If PR_ATTR_HIDDEN shows a value of True, right-click the PR_ATTR_HIDDEN property and select Edit Property.
  9. Uncheck the Boolean checkbox and click OK.
  10. Close all MFCMAPI windows, and restart Outlook.


While you are looking at the folder properties you should also check PR_ATTR_SYSTEM. Its default value is also False, so if you find it currently set to True, after completing steps 1 through 9 above, you should change this value as well, using the additional steps below.
  1. If PR_ATTR_SYSTEM shows a value of True, right-click the PR_ATTR_SYSTEM property and select Edit Property.
  2. Uncheck the Boolean checkbox and click OK.
  3. Close all MFCMAPI windows, and restart Outlook.




https://support.microsoft.com/en-us/help/2992093/

Tuesday, February 28, 2017

[EX2013] Recreate arbitration mailboxes




Setup.exe /PrepareAD /IAcceptExchangeServerLicenseTerms

Get-User | Where {$_.Name –like "SystemMailbox*"} | Enable-Mailbox -Arbitration -Database IT_E15
Get-User | Where {$_.Name –like "FederatedEmail*"} | Enable-Mailbox -Arbitration -Database IT_E15
Get-User | Where {$_.Name –like "Migration*"} | Enable-Mailbox -Arbitration -Database IT_E15

Get-Mailbox –Identity "SystemMailbox{e0dc1c29*" –Arbitration | Set-Mailbox –Arbitration –DisplayName "Microsoft Exchange"

Get-Mailbox –Arbitration –Identity "FederatedEmail*" | Set-Mailbox –Arbitration –ProhibitSendQuota 1MB

Get-Mailbox –Arbitration –Identity "Migration*" | Set-Mailbox –Arbitration –ProhibitSendQuota 300MB

Tuesday, February 21, 2017

[EX2010] Remove special characters in public folder name




  • Look for special character in public folder name:

Get-MailPublicFolder | where {$_.alias.contains(' ') -or $_.alias.contains(',') -or $_.alias.contains('@') -or  $_.alias.contains('(') -or  $_.alias.contains(')') -or  $_.alias.contains(':') -or  $_.alias.contains(';')}



  • To fix the issue, run the cmdlet:

Get-MailPublicFolder | where {$_.alias.contains(' ') -or $_.alias.contains(',') -or $_.alias.contains('@') -or  $_.alias.contains('(') -or  $_.alias.contains(')') -or  $_.alias.contains(':') -or  $_.alias.contains(';')}| Foreach { Set-mailpublicfolder -Identity $_.Identity -Alias ($_.Alias -replace "\s|\,|\@|\(|\)|\:|\;") }



  • Run the first command again to check if still there are public folders with unwanted characters in the name

Sunday, December 18, 2016

[WSRV] Prevent Truncation of Long Output

Check with:


$FormatEnumerationLimit


Modify to unlimited:


$FormatEnumerationLimit =-1

Thursday, March 3, 2016

[WSRV] Check which .NET Framework versions are installed


CMDLET:

Get-ItemProperty -Path “HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full” | Format-List Release



https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx



  1. On the Start menu, choose Run.
  2. In the Open box, enter regedit.exe.
    You must have administrative credentials to run regedit.exe.
  3. In the Registry Editor, open the following subkey:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
    Note that the path to the Full subkey includes the subkey Net Framework rather than .NET Framework.
    System_CAPS_noteNote
    If the Full subkey is not present, then you do not have the .NET Framework 4.5 or later installed.
    Check for a DWORD value named Release. The existence of the Release DWORD indicates that the .NET Framework 4.5 or newer has been installed on that computer.


  1. The value of the Release DWORD indicates which version of the .NET Framework is installed.
    Important
    The following table lists the keys of released versions of the .NET Framework only. It doesn't list the keys of preview or pre-release versions.
Value of the Release DWORD
Version
378389
.NET Framework 4.5
378675
.NET Framework 4.5.1 installed with Windows 8.1 or Windows Server 2012 R2
378758
.NET Framework 4.5.1 installed on Windows 8, Windows 7 SP1, or Windows Vista SP2
379893
.NET Framework 4.5.2
On Windows 10 systems only: 393295

On all other OS versions: 393297
.NET Framework 4.6
On Windows 10 November Update systems only: 394254

On all other OS versions: 394271
.NET Framework 4.6.1
On Windows 10 Anniversary Update and Windows Server 2016: 394802

On all other OS versions: 394806
.NET Framework 4.6.2
On Windows 10 Creators Update only: 460798

On all other OS versions: 460805
.NET Framework 4.7
On Windows 10 Fall Creators Update only: 461308

On all other OS versions: 461310
.NET Framework 4.7.1
On Windows 10 April 2018 Update only: 461808

On all other OS versions: 461814
.NET Framework 4.7.2

[EX2010] Configure TLS Certificate for Receive Connectors




Get-ExchangeCertificate


$cert = Get-ExchangeCertificate -Thumbprint E67EC3C8D679AA35D17678FEC51907272B1BAE2

$tlscertificatename = "<i>$($cert.Issuer)<s>$($cert.Subject)"

Set-ReceiveConnector "EX2016SRV1\Client Frontend EX2016SRV1" -TlsCertificateName $tlscertificatename

Tuesday, January 19, 2016

[EX2013] Collect the virtual directories URLs

Run it directly in the EMS


"### OWA ###" | Out-File c:\url.txt -Append
Get-OwaVirtualDirectory | fl Name,Server,FailbackUrl,InternalUrl,ExternalUrl,*yV* | Out-File c:\url.txt -Append
"### ECP ###"  | Out-File c:\url.txt -Append
Get-EcpVirtualDirectory | fl Name,Server,*Url,*yV*  | Out-File c:\url.txt -Append
"### EWS ###" | Out-File c:\url.txt -Append
Get-WebServicesVirtualDirectory | fl Name,Server,*url,*yV* | Out-File c:\url.txt -Append
"### OAB ###" | Out-File c:\url.txt -Append
Get-OabVirtualDirectory | fl Name,Server,*url*,*yV*  | Out-File c:\url.txt -Append
"### EAS ###" | Out-File c:\url.txt -Append
Get-ActiveSyncVirtualDirectory | fl Name,Server,*url*,*yV*  | Out-File c:\url.txt -Append
"### OA ###"  | Out-File c:\url.txt -Append
Get-OutlookAnywhere | fl Name,Server,*Hostname,*Method*,*SSL*,*yV*  | Out-File c:\url.txt -Append
"### CAS ###"  | Out-File c:\url.txt -Append
Get-ClientAccessServer | fl Fqdn,AutoDiscoverServiceInternalUri,*Site*  | Out-File c:\url.txt -Append
.


(Exchange 2016 only)

"### MAPI ###" | Out-File c:\url.txt -Append
Get-MapiVirtualDirectory | fl Name,Server,*url*,*yV*  | Out-File c:\url.txt -Append

[EX2010] Script to send test messages


To open connectors:

Get-ReceiveConnector |?{$_.Name -like "*defa*"} | Set-ReceiveConnector -PermissionGroups 'AnonymousUsers, ExchangeUsers, ExchangeServers, ExchangeLegacyServers'


To send test messages:

$domain = (Get-AcceptedDomain).name
$fqdn = "$env:computername.$env:userdnsdomain"
$date = Get-Date -UFormat "%m/%d/%Y"
$mbx = Get-Mailbox -RecipientTypeDetails UserMailbox
$tot = read-host "Messages per user"

while ($val -ne $tot) {$val++ ; $mbx | % -Process {Send-MailMessage -To $_.PrimarySmtpAddress -From noreply@$domain -Subject "Test Message from $date - Message # $val" -Body "Please don't reply this message. We are making some tests in our Exchange environment" -SmtpServer $fqdn}}

[EX2010] Install Exchange in Unattended Mode

Exchange 2010

Setup.com  /mode:Install /roles:ClientAccess,Mailbox,HubTransport /MdbName:IT /DbFilePath:c:\mbx\it.edb /Logfolderpath:c:\logs\it /ExternalCASServerDomain:mail.mydomain.usa /UpdatesDir:C:\Users\Administrator\Downloads\up

https://technet.microsoft.com/en-us/library/aa997281(v=exchg.141).aspx


Exchange 2013

Setup.exe  /mode:Install /roles:ClientAccess,Mailbox /MdbName:IT /DbFilePath:c:\mbx\it.edb /Logfolderpath:c:\logs\it /UpdatesDir:C:\Users\Administrator\Downloads\up  /IAcceptExchangeServerLicenseTerms



Friday, January 1, 2016

[EX2010] Search Mailbox


Need to assign the management Roles to perform the search-mailbox for the user account from which we are running the cmdlet in exchange 2010 SP1 or greater


Roles:
Mailbox Import Export
Mailbox Search

example:
new-managementroleassignment -Name "test" -role "Mailbox Import Export" -User "username"
new-managementroleassignment -Name "test1" -role "Mailbox Search" -User "username" 


1)To search the emails older than 01/26/2011 from a particular user's mailbox
Search-Mailbox –identity “Usr name” -SearchQuery ‘kind:email AND received:<01/26/2011’

2)To search the emails older that 01/01/2011 from a perticluar user's mailbox and delete them.
Search-Mailbox –identity “Usr name” -SearchQuery ‘kind:email AND received:<01/26/2011’ -DeleteContent -Force  

3)To search the emails from the specific mailbox database which are older than 01/26/2011.
Get-Mailbox –database “database_name” –resultsize Unlimited |  Search-Mailbox  -SearchQuery ‘kind:email AND received:<01/26/2011’

4)To search the emails from the specific mailbox database which are older than 01/26/2011 and delete them.
Get-Mailbox –database “database_name” –resultsize Unlimited |  Search-Mailbox  -SearchQuery ‘kind:email AND received:<01/26/2011’ –DeleteContent  -Force  

5)To delete messages from all the users on a server which are older than 01/26/2011.
Get-mailbox –server “servername” –resultsize unlimited | Search-Mailbox  -SearchQuery ‘kind:email AND received:<01/26/2011’ –DeleteContent  -Force  

6)To search the emails from the specific mailbox database from a perticlar folder in the mailbox
Get-Mailbox –database “database_name” –resultsize Unlimited |  Search-Mailbox  -SearchQuery ‘In:"folder name"

7)Below example searches the mailbox of myuser and copies the search results to the DiscoveryMailbox in the folder my_user_data.
Search-Mailbox -Identity myuser -SearchQuery 'Subject:”project report”' -TargetMailbox "DiscoveryMailbox" -TargetFolder my_user_data

8)Below example searches Myuser's mailbox for messages that contain the words "project details" in the subject and deletes the messages from the source mailbox.
Search-Mailbox -Identity "Myuser" -SearchQuery 'Subject:"project details"' -DeleteContent
 Note: you can add the delete content at the end to delete all the searched content.

Please find the some key list of AOS search.
To Restrict by File Type:                Use                                        Example
All file types                                 everything                          kind:everything
Communications                           communications                 kind:communications
Contacts                                      contacts                               kind:contacts
E-mail                                         email                                     kind:email
Instant Messenger                        conversations im                    kind:im
Meetings                                      meetings                             kind:meetings
Tasks                                           tasks                                      kind:tasks
Notes                                           notes                                    kind:notes
Documents                                   docs                                       kind:docs
Text documents                            text                                        kind:text
Spreadsheets                               spreadsheets                    kind:spreadsheets
Presentations                               presentations                    kind:presentations
Music                                          music                                    kind:music
Pictures                                       pics                                        kind:pics
Videos                                         videos                                   kind:videos
Folders                                        folders                                  kind:folders
Folder name                                 foldername or in              foldername:mydocs or in:mydocs
Favorites                                      favorites                              kind:favorites

Programs                                     programs                             kind:programs

Thursday, December 31, 2015

[EX2010] Connect Remote EMS to Exchange Server




  • Enable the Windows Integrated authentication in the Powershell virtual directory




    • Use your network logon account to connect to a remote Exchange 2010 server


$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://FQDNofExchangeServer>/PowerShell/ -Authentication Kerberos

Import-PSSession $Session



    • Use a user account that you specify to connect to a remote Exchange 2010 server


$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://FQDNofExchangeServer/PowerShell/ -Authentication Kerberos -Credential $UserCredential

Import-PSSession $Session



Thursday, December 24, 2015

[EX2010] Export Mailboxes to PST



Get-Mailbox –OrganizationalUnit domain.ca/OUName | foreach { New-MailboxExportRequest -Mailbox $_.Alias -FilePath (‘\\server\share\’ + ($_.alias) + ‘.pst’) }

Sunday, October 4, 2015

[EX2010] List mailbox by size


Get-Mailbox -database mydatabase | Get-MailboxStatistics | Sort-Object TotalItemSize -descending |Select-Object DisplayName,ItemCount,@{name="MailboxSize";exp={$_.totalitemsize}} -first 200 | Convertto-Html | out-File report.htm

Monday, September 28, 2015

[EX2010] Add user photo in Exchange 2010 environment



http://blogs.technet.com/b/exchange/archive/2010/03/10/3409495.aspx

http://blogs.technet.com/b/exchange/archive/2010/06/01/3410006.aspx

http://blogs.technet.com/b/ilvancri/archive/2009/11/17/upload-picture-in-outlook-2010-using-the-exchange-management-shell-exchange-2010.aspx


Monday, September 21, 2015

[EX2010] Update GAL and OAB

Sabe quando é adicionado ou removido algum usuário da organização e algum usuário informa que o catálogo de endereço não reflete estas mudanças?

Pois então... compartilho aqui uma lista de passos para atualizarmos as informações na lista de endereços global (GAL), no Catálogo de Endereços Offline e então forçar os servidores a obterem o OAB com as últimas alterações.

Para atualizar os dados da GAL:


  • Get-GlobalAddressList | Update-GlobalAddressList


Uma vez que a GAL está atualizada, precisamos trazer estas últimas alterações para o Offline Address Book:



  • Get-OfflineAddressBook | Update-OfflineAddressBook



Após isto é necessário reiniciar o serviço Background Intelligent Transfer Service no servidor de Mailbox responsável por gerar a OAB


Finalmente, devemos forçar os servidores CAS a copiarem o Ofline Address Book mais atualizado.
Podemos fazer isso de duas formas:


  • Reiniciando o serviço Microsoft Exchange File Distribution (MSExchangeFDS)
Ou rodando o comando para atualização do
  • Update-FileDistributionService "CASServerName"


Lembrando que esse passo deve ser executado em todos os servidores CAS.


Após estes passos, quando o cliente efetuar o download do OAB ou verificar os contatos na GAL, os novos contatos já devem estar presentes.