Flappy Shoot

Tuesday, June 22, 2010

Exchange 2010 - Messaging Policy and Compliance

Configuring retetion tag and policy.

There are three steps involved in configuring Exchange retention tag and policy.

First we need to create retention tag using the cmdlet new-retentionpolicytag. Secondly, it has to be associated with a retention policy (new-retentionpolicy). This policy can be assigned to users using the parameter -retentionpolicy of Set-Mailbox cmdlet.

To see the results immediately you can run the cmdlet Start-ManagedFolderAssistant

Example:

[PS] C:\Windows\system32>New-RetentionPolicyTag -Name "One day retention"`
-AddressForJournaling u5@contoso.com -AgeLimitForRetention 1 -Comment`
"Retention Test" -JournalingEnabled $true -RetentionEnabled $true -RetentionAction`
movetoarchive -Type all

[PS] C:\Windows\system32>New-RetentionPolicy "Move in 1 day policy"`
-RetentionPolicyTagLinks "One day retention"

[PS] C:\Windows\system32>Set-Mailbox tariq.admin -RetentionPolicy `
"Move in 1 day policy" -Force

[PS] C:\Windows\system32>Start-ManagedFolderAssistant

More reading:
http://technet.microsoft.com/en-us/library/dd351165.aspx
http://technet.microsoft.com/en-us/library/dd335226.aspx
http://technet.microsoft.com/en-us/library/dd297970.aspx

Monday, June 21, 2010

Managing Exchange Server 2010 - Powershell Remote Session

First time you may have to set execution policy, enable remote session and allow unencrypted traffic.

Set the Execution Policy:
Set-ExecutionPolicy RemoteSigned

Enable Remote Session:
Enable-PSRemoting

Allow Unencrypted traffic:
set-item -force WSMan:\localhost\Client\AllowUnencrypted $true

To connect to a remote Exchange Server 2010 using different credentials, you need to create credential variable in order to pass it to Exchange Server.

$credetials = get-credential

Create a session:
(Example)

[PS] WSMan:\localhost\Client>$session = New-PSSession -ConfigurationName` microsoft.exchange -ConnectionUri https://mail.contoso.com/powershell`
-Authentication basic -Credential $credetials

Importing the session:

Import-PSSession $SessionFigure

Tuesday, June 15, 2010

Delete files with the name starting with public which last accessed time was 3 days before.

Get-ChildItem \\fpdftp01\EXPRESS `
| Where-Object {$_.name -match "public*" -and $_.PSIsContainer -eq `
$false -and [datetime]::now.adddays(-3) -gt $_.LastaccessTime} `
| foreach ($_) {remove-item $_.fullname -ErrorAction SilentlyContinue `
-Force}