Posts

Showing posts with the label PowerShell

E14–Bulk Create Mail Contact & Set-Contact

Image
  http://community.office365.com/en-us/w/exchange/579.aspx     Get-Contact | Export-Csv c:\temp\contact.csv Get-MailContact | Export-Csv c:\temp\Mailcontact.csv   [PS] Import-Csv .\Contact_Source.csv | % {New-MailContact -Name $_.Name -DisplayName $_.DisplayName -ExternalEmailAddress $_.ExternalEmailAddress -Alias $_.Alias -PrimarySmtpAddress $_.PrimarySMTPAddress -OrganizationalUnit "Contacts" -WhatIf }   [PS] >$Contacts = Import-Csv .\Contact_final.csv [PS] >$Contacts | foreach {Set-Contact $_.Name -Company $_.Company -Department $_.Department -Office $_.Office -Phone $_.Phone }

E14– Query Mailbox non default settings

Image
    [PS] Get-Mailbox -organization Qisdaer -ResultSize unlimited |Where{($_.RecipientLimits -ne 'unlimited')} | f t Name, RecipientLimits [PS] Get-Mailbox -organization Qisdaer -ResultSize unlimited |Where{($_.MaxSendSize -ne 'unlimited')} | ft Name, MaxSendSize   [PS] Get-DistributionGroup   | ft Name, *Accept*

E14–Export & Import Mailbox

Image
  1. 2. [PS] New-MailboxExportRequest -Mailbox mail2k10.johnny -FilePath \\Server\C$\Temp\Mail2k10_johnny_Export.pst -IncludeFolders "行事曆","連絡人" 3.

E14 - How to List all Users Who Have Access to Other Exchange Mailboxes

  http://exchangeserverpro.com/list-users-access-exchange-mailboxes/   [PS] C:\Windows\system32>get-mailbox -OrganizationalUnit System_Accounts | Get-MailboxPermission | Where {$_.user.tostring() -ne "NT AUTHORITY\SELF" -and $_.IsInherited -eq $false} | Select Identity,User,@{Name='Access Rights';Expression={[string]::join(', ', $_.AccessRights)}} | Export-Csv -NoTypeInformation c:\mailboxpermissions.csv

E14- Bulk update Phone

    Name BusinessPhone ABC.DEF 1234-5678   1. [PS] C:\>$csvinfo = Import-Csv   extension.csv 2. [PS] C:\>foreach ($line in $csvinfo) {Get-User -Identity "$($line.name)" | ft Name,Phone >>c:\before_ext-1.txt } 3. [PS] C:\>foreach ($line in $csvinfo) {Get-User -Identity "$($line.name)" | Set-User -Phone "$($Line.Busine ssPhone)"} 4. [PS] C:\>foreach ($line in $csvinfo) {Get-User -Identity "$($line.name)" | ft Name,Phone >>c:\after_ext-1.txt } 5.. excel 檢核 =IF(A2=D2,"Y","No")

E14: DB count & size

  http://msundis.wordpress.com/2011/10/28/quick-tip-view-the-database-size-and-mailbox-count-for-mailbox-databases/ Mailbox count for mailbox databases Get-Mailbox -server BQT-MBX01 -ResultSize:Unlimited | Group-Object -Property:Database | Select-Object Name,Count | Sort-Object -Property:Count –Descending   MailboxDatabase sizes Get-MailboxDatabase -Server bqt-mbx01 -Status | select Servername,Name,databasesize

E14-CSV儲存中文字

    造成亂碼主要是中文編碼的問題,最快的解決方法就是把 xxx.csv 用Notepad開啟,然後到左上方選項「檔案」選擇「另存新檔」,然後會出現儲存視窗,請確認文字編碼為「UTF-8」後,在另存的檔名後面加上.csv,如原本為contact,加完就變成contact.csv,然後按下儲存就可以了! http://www.cloudgss.com/cloud/tw/support/faq/35-videgree-import/111-yahoo-mail-csv

E14–Query Rollup version of Exchange 2010

    [PS] C:\Windows\system32> Get-Command Exsetup.exe | ForEach-Object {$_.FileVersionInfo} ProductVersion   FileVersion      FileName --------------   -----------      -------- 14.03.0174.001   14.03.0174.001   D:\Exchsrvr\bin\ExSetup.exe

LAB: E14 PowerShell: Remove-StoreMailbox (Disconnect Mailbox, SoftDeleted)

Image
  LAB: E14 PowerShell: Remove-StoreMailbox (Disconnect Mailbox, SoftDeleted) 當信箱從 Exchange Server 2010 SP1 信箱資料庫移至任何其他信箱資料庫時,會建立虛刪除的信箱。Exchange 並不會在移動之後完全刪除來源資料庫中的信箱,以避免發生錯誤而造成目的資料庫中的信箱失效。您可以隨時還原來源信箱並再試一次。Exchange 會在保留期間保留虛刪除信箱。 您可以在虛刪除的信箱上執行兩項作業: · 您可以在命令介面中使用 MailboxRestoreRequest 指令程式集將虛刪除信箱還原至現有的 Active Directory 使用者。此指令程式集使用信箱複寫服務 (MRS) 來重新連線信箱。您無法使用 EMC 來執行此程序。如需相關資訊,請參閱 還原虛刪除的信箱 。 · 您可以使用 Remove-StoreMailbox 指令程式永久刪除虛刪除信箱。此程序會清除信箱資料庫中已中斷連線的信箱以及其全部的內容。資料會永久遺失。如需相關資訊,請參閱 永久刪除中斷連線的信箱 。 附註: 您可以只對中斷連線的信箱執行 Remove-StoreMailbox 指令程式。如果您嘗試對作用中信箱執行指令程式,則指令程式會失敗並傳回錯誤。如需如何永久刪除作用中信箱的相關資訊,請參閱 移除信箱 中的「使用命令介面永久移除信箱」。 永久刪除中斷連線的信箱 當您使用 Remove-StoreMailbox Cmdlet 將中斷連線的信箱及其所有內容從信箱資料庫清除時,便會永久遺失資料。已中斷連線的信箱有兩種類型:虛刪除和已停用。執行 Cmdlet 時,您必須指定其中一種類型。如果您指定的類型與已中斷連線信箱的實際類型不符,命令便會失敗。 若要深入了解中斷連線的信箱,請參閱 了解中斷連線的信箱 。 附註: ...

E14 PowerShell - Bulk Modify AD Attributes via Import CSV – Part1

Image
  http://help.outlook.com/zh-tw/140/dd251224.aspx 1. Export CSV from Source Domain C:\Batch> csvde -f c:\Batch\aliax.csv -d OU=BI40,OU=System_Accounts,OU=TestLaber,DC=TestLab,DC=corp,DC=com -r (mailnickname=*) -l mailnickname,proxyaddresses,sAMAAccountname -p subtree C:\Batch> csvde -f c:\Batch\aliax.csv -d OU=BI40,OU=System_Accounts,OU=TestLaber,DC=TestLab,DC=corp,DC=com -r (mailnickname=*) -p subtree   2. Modify CSV for Import   3. Read MailNickName and import to PhysicalOfficeLocation before MailEnable 3.1 Get-User –Filter [PS] C:\>Get-User -Filter {samaccountname -eq "FlowerOnline"} Name                                                        Recipie...

ADMT CrossForest 2003-2010 Part4 – NEW-MoveRequest

Image
    New-MoveRequest 1.  Create CSV   2. [PS] C:\Program Files\Microsoft\Exchange Server\V14\Scripts> Import-Csv c:\Temp\import.csv | New-MoveRequest -RemoteLegacy -TargetDatabase "Mailbox Database 1563432160" -RemoteGlobalCatalog JS-AD2.js_domain.Test.com.tw -RemoteCredential $Remote -TargetDeliveryDomain "Test.com.tw" 3. Completed Move-Request

ADMT CrossForest 2003-2010 Part3 – Bulk Prepare-moverequest

Image
http://www.myexchangeworld.com/tag/migration/ Prepare-MoveReuqest to Append X.500 address on source and target Object. 1. $Local = Get-Credential 2. 3. Create Import.CSV   4. Run Prepare-MoveRequest.ps1 Import-Csv c:\Temp\Import.csv | .\Prepare-MoveRequest.ps1 -RemoteForestDomainController JS-AD2.js_domain.TEST.com.tw -RemoteForestCredential $Remote -LocalForestDomainController NewDC1.JSFunds.com.tw -LocalForestCredential $Local -TargetMailUserOu "ou=TEST_Import,DC=TEST,DC=com,DC=tw" –UseLocalObject E2003 E2010   ===================================== [PS] C:\> .\prepare-moverequest.ps1 identity "cn=admt.test2,ou=test,dc=js_domain,dc=TEST,dc=com,dc=tw" -RemoteForestDomainController s-ad1.js_domain.TEST.com.tw -RemoteForestCredential $Remote -localForestDomainController s-ad6.TEST.com.tw -localforestcredential $Local -TargetMailUserOu "ou=TestOU,DC=TEST,DC=com,DC=tw" –U...

LAB: Exchange 2010 Resource Mailbox (Room Mailbox)– Part 2

Image
  Set-CalendarProcessing http://technet.microsoft.com/en-us/library/dd335046.aspx 1. Meeting Room displayed on GAL 2. Request a “recurring meeting” 3. First rejected reason 4. Get-CalendarProcessing -Identity room137 | fl BookingWindowInDays Set-CalendarProcessing -Identity room137 -BookingWindowInDays 360 5. 6. 7.

Ticket: Exhcnage 2010 upgrade AddressList

Image
    http://blogs.technet.com/b/ilvancri/archive/2010/06/15/don-t-forget-to-update-your-ldap-filters-to-opath-filters-when-transitioning-from-exchange-2003-to-exchange-2010.aspx   1. download PS1 from MSExchangeTeamBlog 2. Update methods # Examples on ways to use this script in Powershell... # To convert a manually entered filter and display the result: # # .\ConvertFrom-LdapFilter "(&(mailnickname=*))" # # To convert the LDAP filter on an existing address list and display the result: # # .\ConvertFrom-LdapFilter (Get-AddressList "My Address List").LdapRecipientFilter # To convert the LDAP filter on an existing address list and update the address list with the new filter: # # Set-AddressList "My Address List" -RecipientFilter ( .\ConvertFrom-LdapFilter (Get-AddressList "My Address List").LdapRecipientFilter ) # To convert all existing l...