Powered By Blogger

вторник, 31 июля 2012 г.

Преобразование в число в PoSh

Например:




1.PS> $number = Read-Host 'Enter a number'
2.Enter a number: 100
3.PS> $number * 12
4.100100100100100100100100100100100100

Теперь то же самое с явным указанием типа [Double]:


1.PS> $number = [Double](Read-Host 'Enter a number')
2.Enter a number: 100
3.PS> $number * 12
4.1200


http://www.articles-it.ru/programming/scripts/145-powershell-convert-to-numeric.html

пятница, 20 июля 2012 г.

Определение свободного пространства в БД


Get-MailboxDatabase [database name] -status | Format-Table Name, DatabaseSize, AvailableNewMailboxSpace

или для нескольких БД:

Get-MailboxDatabase | where  {($_.Identity -like "шаблон имени БД *")} | Get-MailboxDatabase -status | Format-Table Name, DatabaseSize, AvailableNewMailboxSpace                                                                                                                                                                                

среда, 18 июля 2012 г.

Удаление disconnected и soft-deleted ящиков

If you want to remove all disconnected mailboxes from a database, run the following command

Get-MailboxStatistics –Database “dbname” | Where-Object {$_.DisconnectReason –eq “Disabled”} | ForEach {Remove-StoreMailbox –Database $_.database –identity $_.mailboxguid –MailboxState Disabled

If you want to remove all soft-deleted mailboxes from a database, run the following command

Get-MailboxStatistics –Database “dbname” | Where-Object {$_.DisconnectReason –eq “Softdeleted”} | ForEach {Remove-StoreMailbox –Database $_.database –identity $_.mailboxguid –MailboxState Softdeleted

http://penetrateit.wordpress.com/2012/03/07/exchange-2010-purgeremove-disconnected-or-soft-deleted-mailboxes/

Настройка автоконфигурации прокси (PAC)

понедельник, 16 июля 2012 г.

Удаление отключенных ящиков


Listing all disconnected mailboxes

Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid

Removing a single entry

Remove-Mailbox -Database <Database-Name> -StoreMailboxIdentity <MailboxGuid> -confirm:$false

четверг, 12 июля 2012 г.

Перенос БД и\или логов Exchange

http://technet.microsoft.com/en-us/library/dd979782.aspx


1.Note any replay lag or truncation lag settings for all copies of the mailbox database being moved. You can obtain this information by using the Get-MailboxDatabase cmdlet, as shown in this example.


 Get-MailboxDatabase DB1 | fl *lag*

2.If circular logging is enabled for the database, it must be disabled before proceeding. You can disable circular logging for a mailbox database by using the Set-MailboxDatabase cmdlet, as shown in this example.


 Set-MailboxDatabase DB1 -CircularLoggingEnabled $false

3.Remove all mailbox database copies for the database being moved. For detailed steps, see Remove a Mailbox Database Copy. After all copies are removed, preserve the database and transaction log files from each server from which the database copy is being removed by moving them to another location. These files are being be preserved so the database copies to not require re-seeding after they have been re-added.

4.Move the mailbox database path to the new location. For detailed steps, see Move the Database Path.

Important:
During the move operation, the database being moved must be dismounted. Until the move is complete, this process will cause an interruption in service and an outage for all users with mailboxes on the database being moved. After the move operation completes, the database is automatically mounted.

5.Create the necessary folder structure on each Mailbox server that previously contained a passive copy of the moved mailbox database. For example, if you moved the database to C:\mountpoints\DB1, you must create this same path on each Mailbox server that will host a mailbox database copy.

6.After creating the folder structure, move the passive copy of the mailbox database and its log stream to the new location. These are the files that were left from and preserved after Step 3. Repeat this process for each database copy that was removed in Step 3.

7.Add all of the database copies that were removed in Step 3. For detailed steps, see Add a Mailbox Database Copy.

8.On each server that contains a copy of the mailbox database being moved, run the following commands to stop and restart the content index services.


Net stop msftesql-Exchange
Net start MSExchangeSearch

9.Optionally, enable circular logging by using the Set-MailboxDatabase cmdlet, as shown in this example.


 Set-MailboxDatabase DB1 -CircularLoggingEnabled $true

10.Reconfigure any previously set values for replay lag time and truncation lag time by using the Set-MailboxDatabaseCopy cmdlet, as shown in this example.


 Set-MailboxDatabaseCopy DB1\MBX2 -ReplayLagTime 00:15:00

11.As each copy is added, we recommend that you verify the health and status of the copy prior to adding the next copy. You can verify the health and status by:

a.Examining the event log for any error or warning events related to the database or the database copy.

b.Using the Get-MailboxDatabaseCopyStatus cmdlet to check the health and status of continuous replication for the database copy.

c.Using the Test-ReplicationHealth cmdlet to verify the health and status of the database availability group and continuous replication.

среда, 11 июля 2012 г.

Количество п\я заданного размера в БД

Get-Mailbox -Database [database name]| Get-MailboxStatistics | where { ($_.TotalItemSize -le "500 MB") -and ($_.TotalItemSize -gt "1 MB")} | Sort-Object DisplayName | ft DisplayName, TotalItemSize