Posted by: Preetam | October 17, 2007

Step03-StorageGroupCreation

$Storagegrp=read-host “Please enter the Storage group name you need to create”

$MBXStorename=$Storagegrp+”MBX”

write-host(“+”*30)

Write-host “”

Write-host “Mailbox store $MBXStorename will be created and automatically mounted for you”

New-storagegroup -name $Storagegrp -server WS03R2EEEXCHLCS | New-MailboxDatabase -Name $MBXStorename

# ============================

$date=get-date

$futdate=$date.addseconds(10)

$towait=$futdate – $date

$waittime=$towait.seconds

while($waittime -gt 0) {

$waittime=$waittime-1

write-host “Warning: Operation is in progress …” -foreground yellow

start-sleep -s 1

#=======================

if($waittime -le 0)

{

if((Get-MailboxDatabase $MBXStorename).databasecreated)

{

write-host “failed to mount database, it is already mounted or was not created” -foreground RED

$waittime=0

}

#=======================

else

{

Mount-Database -Identity $MBXStorename

start-sleep -s 10

Write-Host ” See below if your DB was mounted”

Get-MailboxDatabase -Status | where{$_.mounted -eq $true}

}

}

#=======================

}


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: