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}

Sunday, May 30, 2010

# Consolidate files in multiple folders to a single folder.

$songs= Get-ChildItem "E:\Tamil & Tamil\Ilaiyaraja - Hits Songs" -Recurse | where-object {$_.PSIsContainer -eq $false}

$songs | foreach ($_) {copy $_.fullname "E:\Tamil & Tamil\Ilaiyaraja - Hits Songs\IllaiyarajaComplete"}

Thursday, May 20, 2010

Exchange 2010 Update Rollups

Read more information about fixes and improvements included at the below URL

Rollup 1
http://msexchangeteam.com/archive/2009/12/09/453485.aspx

Rollup 2
http://msexchangeteam.com/archive/2010/03/05/454155.aspx

Rollup 2
http://msexchangeteam.com/archive/2010/03/19/454335.aspx

Wednesday, May 19, 2010

Installing Exchange 2010 rollups on DAG servers

Great post on installing rollups on DAG

http://www.ucblogs.net/blogs/exchange/archive/2009/12/15/Installing-Exchange-2010-rollups-on-DAG-servers.aspx

Monday, May 10, 2010

Exchange Server 2010 - Database Portability

Mounting Mailbox Database on Alternate Servers - Database Portability
Database portability is a feature that enables Exchange Server 2010 mailbox database to be moved to or mounted on any other mailbox server in the same organization.
Steps:
Source database name: movedatabase
Target database name: movedatabase1

1. Make sure to commit any uncommitted transaction log files to the source database.
Dismount the source database (in our case it is movedatabase)
Command: dismount-database "movedatabase"
Command to commit transaction logs: eseutil /r Enn
Note: To determine the logfile prefix (Enn): get-mailboxdatabase "movedatabase" fl logfileprefix

2. Create a new mailbox database on the target server
Command: New-MailboxDatabase -Name "movedatabase1" -Server Exch2010 -Edbfilepath c:\mdbdata\movedatabase\movedatabase.edb -Logfilepath c:\mdbdata\movedatabase

3. Do not mount the database, just enable the database to be overwritten
Command: Set-MailboxDatabase -identity "movedatabase1" -AllowFileRestore $true

4. Move the database files manually from source server to target (.edb file, log files and Exchange Search Catalog)

5. Mount the target database (movedatabase1)
Command: Mount-Database "movedatabase1"

6. Now you must modify the user account settings point to the mailbox on the new mailbox server. Command: Get-Mailbox -database "movedatabase" where-object {$_.objectclass -NotMatch '(SystemAttendantMailbox ExOleDbSystemMailbox)'} Set-Mailbox -database "movedatabase1"

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

Sunday, May 9, 2010

Exchange VSS Writer Error

The consistency check for the component '27303ddc-08f7-4007-ac1f-13a07ed65d30'\'Microsoft Exchange Server\Microsoft Information Store\EXCH2010' has failed. The application 'Exchange' will not be available in the backup created at '‎2010‎-‎05‎-‎09T17:17:20.601180800Z'. Review the event details for information about consistency check issues.

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExchangeServer\v14\Replay\Parameters
Create a DWORD "EnableVSSWriter" with a value 0




Saturday, May 8, 2010

Sending mail from Exchange Management Shell in Exchange Server 2010.

Syntax for Send-MailMessage:






Administrator are not allowed to send mail by default for security reasons.

























Ref:
http://technet.microsoft.com/en-us/library/dd347693.aspx
http://www.msexchange.org/articles_tutorials/exchange-server-2010/management-administration/using-send-mail-feature-exchange-server-2010.html

Monday, April 5, 2010

Delete Files and Folders - Powershell

# Delete files and folders which are not accessed for more than 3 days under the specifed folder tree.
# Example .\Multidelete.ps1 c:\mytest
param ([String]$temp)


$twodaysbefore = [datetime]::now.adddays(-3)



Get-ChildItem $temp -recurse -ErrorAction SilentlyContinue | `
where {$twodaysbefore -gt $_.LastaccessTime} | `
foreach ($_) {remove-item $_.fullname -ErrorAction SilentlyContinue -Force }

Monday, March 29, 2010

How to find startup type of a service in Powershell.

Get-Service cmdlet does not have a property to find the startup type of a service. So we need to use Get-WMIObject.
(Get-WmiObject Win32_Service -filter "Name='W32Time'").StartMode

Reference: http://www.bhargavs.com/index.php/powershell/2009/06/powershell-get-service-startuptype/

Thursday, March 4, 2010

Exchange 2007 / 2010: Upgrading your default Email Address Policy and Address List

Error:"Unable to edit the specified E-mail address policy. E-mail address policies created with legacy versions of Exchange must be upgraded using the 'Set-EmailAddressPolicy' task, with the Exchange 2007 Recipient Filter specified."

Check for legacy filter "RecipientFilterType is "Legacy" " using the commandlet below

Get-EmailAddressPolicy | Format-List Name,*RecipientFilter*,ExchangeVersion

or

Get-EmailAddressPolicy | where { $_.RecipientFilterType -eq "Legacy" }

Upgrading the legacy EAP

Set-EmailAddressPolicy "Default Policy" -IncludedRecipients AllRecipients

Upgrading your Default Address Lists

Check for legacy filter "RecipientFilterType is "Legacy" " using the commandlet below

Get-AddressList | Format-List Name,*RecipientFilter*,ExchangeVersion

Get-GlobalAddressList | Format-List Name,*RecipientFilter*,ExchangeVersion

Upgrading the legacy AL

Set-AddressList "All Users" -IncludedRecipients MailboxUsers

Set-AddressList "All Groups" -IncludedRecipients MailGroups

Set-AddressList "All Contacts" -IncludedRecipients MailContacts

Set-AddressList "Public Folders" -RecipientFilter { RecipientType -eq 'PublicFolder' }

Set-GlobalAddressList "Default Global Address List" -RecipientFilter {(Alias -ne $null -and (ObjectClass -eq 'user' -or ObjectClass -eq 'contact' -or ObjectClass -eq 'msExchSystemMailbox' -or ObjectClass -eq 'msExchDynamicDistributionList' -or ObjectClass -eq 'group' -or ObjectClass -eq 'publicFolder'))}


Reference: http://msexchangeteam.com/archive/2007/01/11/432158.aspx

Wednesday, February 3, 2010

Sample script generated by SCVMM 2008 while creating a new VM

# ------------------------------------------------------------------------------
# New Virtual Machine Script
# ------------------------------------------------------------------------------
# Script generated on Thursday, February 04, 2010 6:39:13 AM by Virtual Machine Manager
#
# For additional help on cmdlet usage, type get-help
# ------------------------------------------------------------------------------


New-VirtualNetworkAdapter -VMMServer localhost -JobGroup 0ae875e5-99a6-4ae8-9cb5-c3375328954c -PhysicalAddressType Dynamic -VirtualNetwork "FP7 Network" -VLanEnabled $false


New-VirtualDVDDrive -VMMServer localhost -JobGroup 0ae875e5-99a6-4ae8-9cb5-c3375328954c -Bus 1 -LUN 0

$CPUType = Get-CPUType -VMMServer localhost where {$_.Name -eq "2.40 GHz Xeon"}


New-HardwareProfile -VMMServer localhost -Owner "MCNMENA\tariq.admin" -CPUType $CPUType -Name "Profilea0eef8f3-59c2-4990-994d-c524ac2f02fe" -Description "Profile used to create a VM/Template" -CPUCount 2 -MemoryMB 1500 -RelativeWeight 100 -HighlyAvailable $false -NumLock $false -BootOrder "CD", "IdeHardDrive", "PxeBoot", "Floppy" -LimitCPUFunctionality $false -JobGroup 0ae875e5-99a6-4ae8-9cb5-c3375328954c



New-VirtualDiskDrive -VMMServer localhost -IDE -Bus 0 -LUN 0 -JobGroup 0ae875e5-99a6-4ae8-9cb5-c3375328954c -Size 20480 -Dynamic -Filename "Exch2010_disk_1"

$VMHost = Get-VMHost -VMMServer localhost where {$_.Name -eq "fpdhpv02.mcnmena.local"}
$HardwareProfile = Get-HardwareProfile -VMMServer localhost where {$_.Name -eq "Profilea0eef8f3-59c2-4990-994d-c524ac2f02fe"}
$OperatingSystem = Get-OperatingSystem -VMMServer localhost where {$_.Name -eq "64-bit edition of Windows Server 2008 Enterprise"}

New-VM -VMMServer localhost -Name "Exch2010" -Description "" -Owner "MCNMENA\tariq.admin" -VMHost $VMHost -Path "E:\VirtualArea" -HardwareProfile $HardwareProfile -JobGroup 0ae875e5-99a6-4ae8-9cb5-c3375328954c -RunAsynchronously -OperatingSystem $OperatingSystem -RunAsSystem -StartAction TurnOnVMIfRunningWhenVSStopped -DelayStart 0 -StopAction SaveVM

Monday, February 1, 2010

IE 8 Freezing Randomly

Hi,
My laptop’s IE 8 was freezing randomly and checking the event log revealed a faulty adobe plug-in. I have followed the steps described in the below link to uninstall and update the adobe Flash version. Also did an IE reset (Tools -> Advanced). Now things seems to be fine.
Steps not mentioned in the below link:
1. Close all IE instances.
2. After uninstalling Adobe Flash, restart the machine before upgrading to latest Adobe Flash.
http://forums.adobe.com/thread/559169?tstart=0


Log Name: Application
Source: Application Error
Date: 2/1/2010 4:58:01 PM
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Computer: tariq_win7.xxx.LOCAL
Description:
Faulting application name: iexplore.exe, version: 8.0.7600.16385, time stamp: 0x4a5bc69e
Faulting module name: Flash10d.ocx, version: 10.0.42.34, time stamp: 0x4ae7baed
Exception code: 0xc0000005
Fault offset: 0x0015843d
Faulting process id: 0x1328
Faulting application start time: 0x01caa32b8b8f6cda
Faulting application path: C:\Program Files (x86)\Internet Explorer\iexplore.exe
Faulting module path: C:\Windows\SysWow64\Macromed\Flash\Flash10d.ocx
Report Id: 6d4f1fea-0f31-11df-a224-002186c48273
Event Xml:
1000
2
100
0x80000000000000
1979
Application
tariq_win7.xxx.LOCAL
iexplore.exe
8.0.7600.16385
4a5bc69e
Flash10d.ocx
10.0.42.34
4ae7baed
c0000005
0015843d
1328
01caa32b8b8f6cda
C:\Program Files (x86)\Internet Explorer\iexplore.exe
C:\Windows\SysWow64\Macromed\Flash\Flash10d.ocx
6d4f1fea-0f31-11df-a224-002186c48273