Thursday 22 November 2012

Exchange Powershell Script

Exchange Control Panel (ECP):
Get-EcpVirtualDirectory | fl *url*, ide*

Set-EcpVirtualDirectory –Identity “TLCAS01\ecp (Default Web Site)” –ExternalUrl https://mail.testlabs.se/ecp

Autodiscover:
Get-ClientAccessServer | fl *uri*

Set-ClientAccessServer –Identity TLCAS01 –AutoDiscoverServiceInternalUri https://autodiscover...utodiscover.xml

Exchange ActiveSync (EAS):
Get-ActiveSyncVirtualDirectory | fl *url*, ide*

Set-ActiveSyncVirtualDirectory –Identity “TLCAS01\Microsoft-Server-ActiveSync (Default Web Site)” –ExternalUrl https://mail.testlab...rver-ActiveSync

Exchange Web Services (EWS):
Get-WebServicesVirtualDirectory | fl *url*, ide*

Set-WebServicesVirtualDirectory –Identity “TLCAS01\EWS (Default Web Site)” –ExternalUrl https://mail.testlab...S/Exchange.asmx

Offline Address Book (OAB):
Get-OabVirtualDirectory | fl *url*, ide*,pol*

Set-OabVirtualDirectory –Identity “TLCAS01\OAB (Default Web Site)” –ExternalUrl https://mail.testlabs.se/OAB –PollInterval 60

Outlook Web App (OWA):
Get-OwaVirtualDirectory | fl *url*, ide*

Set-OwaVirtualDirectory –Identity “TLCAS01\OWA (Default Web Site)” –ExternalUrl https://mail.testlabs.se/OWA

PowerShell:
Get-PowerShellVirtualDirectory | fl *url*, ide*

Set-PowerShellVirtualDirectory –Identity “TLCAS01\PowerShell (Default Web Site)” –ExternalUrl https://mail.testlabs.se/powershell

Enable Outlook Anywhere:

Enable-OutlookAnywhere –Server TLCAS01 –ExternalHostname mail.testlabs.se –InternalHostname tlcas01.testlabs.se –ExternalClientAuthenticationMethod Basic –InternalClientAuthenticationMethod Ntlm –IISAuthentication Ntlm –SSLOffloading:$false
Get-OutlookAnywhere –Server TLCAS01
Get-AcceptedDomain
New-AcceptedDomain –Name testlabs.com –DomainName testlabs.com –DomainType Authoritative
Get-EmailAddressPolicy
Get-EmailAddressPolicy | fl


Send & Receive Connector
Get-ReceiveConnector
Get-ReceiveConnector | fl
Set-ReceiveConnector –Identity “TLCAS01\Default Frontend TLCAS01” –MaxMessageSize 30MB
Get-ReceiveConnector | fl ide*,maxmes*
Get-SendConnector
Get-SendConnector| fl

New-SendConnector –Name “Outbound” –AddressSpaces ‘*’ –SourceTransportServers TLMB01 –MaxMessageSize 30MB

New-SendConnector –Name “Outbound” –AddressSpaces ‘*’ –SourceTransportServers TLMB01 –
MaxMessageSize 30MB –DNSRoutingEnabled:$false –SmartHosts “10.10.10.10”

New-SendConnector –Name “Outbound” –AddressSpaces ‘*’ –SourceTransportServers TLMB01 –
MaxMessageSize 30MB –DNSRoutingEnabled:$false –SmartHosts “10.10.10.10” –FrontEndProxyEnabled:$True

Get-SendConnector| fl ide*,maxmes*

Globaladdresslis
Get-Globaladdresslist | update-Globaladdresslist
Get-Addresslist | Update-Addresslist
New-GlobalAddressList -Name "gal" -RecipientFilter {(MemberOfGroup -eq 'cn=<GROUP NAME>,OU=Exchange Groups,DC=ggncloud,DC=internal')}

Update-GlobalAddressList -Identity "gal"
update-AddressList -Identity '\All Contacts
Move Request
New-MoveRequest -Identity 'tony@alpineskihouse.com' -TargetDatabase DB01 –WhatIf    
New-MoveRequest -Identity 'tony@alpineskihouse.com' -TargetDatabase DB01 -BadItemLimit  100
New-MoveRequest -Identity 'tony@alpineskihouse.com' -TargetDatabase DB01 -BadItemLimit 200 -AcceptLargeDataLoss
New-MoveRequest -Identity 'Kweku' -PrimaryOnly -TargetDatabase "DB01" -BadItemLimit 100 –AcceptLargeDataLoss
Get-MoveRequest –MoveStatus queued |Get-MoveRequestStatistics | ft -auto alias,Status,TotalMailboxSize,PercentComplete,TargetDatabase,TotalInProgressDuration
Suspend-MoveRequest -Identity Shaji_John@abc.com -SuspendComment "Resume suspended request.after @12 PM Today"
Get-MoveRequest -MoveStatus queued | Suspend-MoveRequest -SuspendComment "Resume suspended request.after completion Domino & Cadista"
Get-MoveRequest -MoveStatus suspended | Resume-MoveRequest
Get-LogonStatistics -Database DB-MBX-2
Get-LogonStatistics -Identity shiva_prasad@abc.com
Get-MoveRequest -MoveStatus failed -TargetDatabase DB-mbx1
Get-MoveRequest –MoveStatus Rajesh_Kajalkar@xyz.com
Get-MoveRequest -TargetDatabase DB-MBX-M8 | Suspend-MoveRequest -SuspendComment "Resume @ 12 PM."
Suspend-MoveRequest -TargetDatabase DB-MBX-M8 -SuspendComment "Resume @ 12 PM."
(Get-MoveRequest  –MoveStatus queued).count
(Get-MailboxStatistics -Database DB-MBX-3).Count
Get-Mailbox -Database DB-MBX-G7 | Get-MailboxStatistics | Select-Object DisplayName, ServerName, Database,
TotalItemSize, ItemCount, StorageLimitStatu
 
MailboxStatistics
Get-MailboxStatistics -Server ggncloud | Where {$_.DisconnectDate -ne $null} | Format-Table DisplayName,Database

Get-MailboxStatistics -Server HNLMBX01 | Where {$_.DisconnectDate -ne $null} | Format-Table DisplayName,DisconnectDate
Get-MailboxStatistics -Server HNLMBX01 | Where-Object {$_.DisconnectDate
-gt (Get-Date).AddDays(-7)} | Format-Table displayName,ServerName,
DatabaseName, TotalItemSize -Autosize

Get-MailboxStatistics -Database db3 | where {$_.LastLogonTime -lt
(Get-Date).AddDays(-7)}} | Format-Table displayName,lastlogontime,
lastloggedonuseraccount,ggncloud

Get-MoveRequestStatistics -database db3
Get-Mailbox -Database db3 | New-MoveRequest -TargetDatabase db4
Get-LogonStatistics -Server ggncloud

TransportRule
New-TransportRule -Name 'TS Rule1' -Comments 'transportrule' -Priority '0' -Enabled $true -From 'shailendra@corp.mld' -DeleteMessage $true -ExceptIfFrom 'john@corp.mld'

DatabaseAvailabilityGroup
Restore-DatabaseAvailabilityGroup –Identity DAG1 –ActiveDirectorySite ggncloud
Remove-DatabaseAvailabilityGroupServer -MailboxServer 'RAKESH' -Identity 'DAG2
Get-MailboxDatabase -Status | Sort-Object name | Format-Table Name, DatabaseSize, AvailableNewMailboxSpace
Get-MailboxDatabase -Identity databasename -Status | Format-Table Name, DatabaseSize, AvailableNewMailboxSpace
Get-DatabaseAvailabilityGroupNetwork -Identity DAG2 | fl name, MapiAccessEnabled
Suspend-MailboxDatabaseCopy -Identity DB1\MBX2 -ActivationOnly

Resume-MailboxDatabaseCopy -Identity DB1\MBX2
Set-MailboxServer -Identity MailboxServer–DatabaseCopyAutoActivationPolicy
Set-MailboxServer -Identity MailboxServer–DatabaseCopyAutoActivationPolicy

DynamicDistributionGroup
New-DynamicDistributionGroup -Name "All Research" -IncludedRecipients ‘MailboxUsers’
-ConditionalDepartment ‘Research’ -OrganizationalUnit ‘its’-Alias ‘AllResearch’

new-DynamicDistributionGroup -Name 'DDG-ITS' -RecipientContainer 'corp.mld/ITS' -IncludedRecipients 'AllRecipients' -OrganizationalUnit 'corp.mld/ITS' -Alias 'DDGits'

Set-DynamicDistributionGroup -Name "All Research" -MaxReceiveSize 75KB
New Mailbox


New-Mailbox -Name "System Administrator" -FirstName "System" -LastName "Administrator" -DisplayName "System Administrator" -Alias "sysadmin" -SamAccountName "sysadmin" -organizationalUnit "Test" -Database "MBXDB3" -UserPrincipalName sysadmin@test.com

New-Mailbox -Name:'Help Desk' -OrganizationalUnit:'corp.mld' -Database:'DB01' -UserPrincipalName:'helpdesk@corp.mld' -Shared

Import-CSV "c:\CreateTest.csv" | ForEach-Object { New-Mailbox -Lastname $_.”LastName” -Name $_."DisplayName" -FirstName $_.”FirstName” -Alias $_.”Alias” -SamAccountName $_.”SamAccountName” -organizationalUnit "OU=Test,OU=Departments,DC=test,DC=ac,DC=in" -Database "MBXDB3" -UserPrincipalName $_.”UserPrincipalName” -Password (ConvertTo-SecureString $_.password -AsPlainText -Force)}

FirstNameLastNameDisplayNameAlias SamAccountNamePasswordUserPrincipalName
SystemAdministratorSystem Administratorsysadmin   sysadminnKP5Z6Bzsysadmin@test.com

7 comments:

  1. Hey! I just wanted to ask if you ever have any trouble with
    hackers? My last blog (wordpress) was hacked and I
    ended up losing a few months of hard work due to no backup.
    Do you have any solutions to stop hackers?
    Here is my web page : http://www.teenpornpost.com/brunette-does-a-blowjob

    ReplyDelete
  2. Have you ever considered creating an ebook or guest authoring on other blogs?
    I have a blog centered on the same subjects you discuss and would really like to have you share some stories/information.
    I know my audience would value your work. If you are even remotely interested, feel free
    to send me an e-mail.
    Look at my homepage amateur porn

    ReplyDelete
  3. I leave a response whenever I especially enjoy a post on a site or if I have something to contribute to the conversation.

    Usually it's triggered by the sincerness communicated in the article I looked at. And on this article "Exchange Powershell Script". I was actually excited enough to drop a comment :-) I do have a couple of questions for you if it's okay.

    Could it be only me or do some of these comments appear like written by brain dead folks?
    :-P And, if you are posting at other online sites, I'd like to keep up with everything new you have to post. Could you list every one of all your public sites like your Facebook page, twitter feed, or linkedin profile?
    my site :: Threesome teen banging

    ReplyDelete
  4. When someone writes an piece of writing he/she maintains the plan of
    a user in his/her brain that how a user can understand it.
    Thus that's why this article is perfect. Thanks!
    Also visit my weblog :: Saima

    ReplyDelete
  5. What's up, I desire to subscribe for this website to take latest updates, thus where can i do it please assist.
    Here is my webpage : contractors in Orlando

    ReplyDelete
  6. Remarkable! Its really remarkable post, I have got much clear
    idea regarding from this paragraph.

    Look at my webpage :: www.sexykoo.com

    ReplyDelete
  7. Thanks to my father who stated to me concerning this blog, this blog is genuinely awesome.


    Feel free to surf to my blog email newsletter templates

    ReplyDelete