Enterprise Vault, one of the widely used/accepted solution for Email and File Archiving. The solution has improved drastically in version 11. However, it lack control in many area such as monitoring, partition size monitoring etc.
This script will help you to extract the existing size of all open partitions across all Enterprise Vault Servers. The script is tested on Enterprise Vault Ver 11.0. Download the complete script do few modification to work with your infra.
Note - The Enterprise Vault scripts will only run on x86 powershell version. This limitation is because the commands from EV are not designed to work in 64 bit version of powershell. Ensure you run the script in x86 powershell.
Import-Module "C:\Program Files (x86)\Enterprise Vault\Symantec.EnterpriseVault.PowerShell.AdminAPI.dll"
Import-Module "C:\Program Files (x86)\Enterprise Vault\Symantec.EnterpriseVault.PowerShell.Core.dll"
Import-Module "C:\Program Files (x86)\Enterprise Vault\Symantec.EnterpriseVault.PowerShell.IMAP.dll"
Import-Module "C:\Program Files (x86)\Enterprise Vault\Symantec.EnterpriseVault.PowerShell.Monitoring.dll"
$PartitionSize = "C:\Scripts\HTML\Partition_Size.htm" #Update the path you wish to save the HTML output
$serverlist = (Get-EVComputers | select ComputerNameAlternate).ComputerNameAlternate
$evsite = (Get-EVSite | select Name).Name
$ModeValue = "False"
$date = ( Get-Date ).ToString('yyyy/MM/dd - hh:mm')
#Update with your infra details (Only if you wish to receive email notification)
$smtphost = "smtp.yourdomain.local"
$from = "This email address is being protected from spambots. You need JavaScript enabled to view it."
$to = "This email address is being protected from spambots. You need JavaScript enabled to view it."
New-Item -ItemType file $PartitionSize -Force
Function writeHtmlHeader
{
param($fileName)
Add-Content $fileName "<html>"
Add-Content $fileName "<head>"
Add-Content $fileName "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>"
Add-Content $fileName '<title>Enterprise Vault MSMQ Monitor</title>'
add-content $fileName '<STYLE TYPE="text/css">'
add-content $fileName "<!--"
add-content $fileName "td {"
add-content $fileName "font-family: Tahoma;"
add-content $fileName "font-size: 11px;"
add-content $fileName "border-top: 1px solid #999999;"
add-content $fileName "border-right: 1px solid #999999;"
add-content $fileName "border-bottom: 1px solid #999999;"
add-content $fileName "border-left: 1px solid #999999;"
add-content $fileName "padding-top: 0px;"
add-content $fileName "padding-right: 0px;"
add-content $fileName "padding-bottom: 0px;"
add-content $fileName "padding-left: 0px;"
add-content $fileName "}"
add-content $fileName "body {"
add-content $fileName "margin-left: 5px;"
add-content $fileName "margin-top: 5px;"
add-content $fileName "margin-right: 0px;"
add-content $fileName "margin-bottom: 10px;"
add-content $fileName ""
add-content $fileName "table {"
add-content $fileName "border: thin solid #000000;"
add-content $fileName "}"
add-content $fileName "-->"
add-content $fileName "</style>"
Add-Content $fileName "</head>"
Add-Content $fileName "<body>"
}
Function writeHtmlFooter
{
param($fileName)
Add-Content $fileName "</body>"
Add-Content $fileName "<br/><br/>"
Add-Content $fileName "</html>"
}
Function writeTableMemHeader
{
param($fileName)
Add-Content $fileName "<tr bgcolor=#B0AE5B>"
Add-Content $fileName "<td width='10%' align='center'>Server Name</td>"
Add-Content $fileName "<td width='30%' align='center'>Folder Path</td>"
Add-Content $fileName "<td width='15%' align='center'>Size in GB</td>"
Add-Content $fileName "</tr>"
}
writeHtmlHeader $PartitionSize
add-content $PartitionSize "<table width='55%'>"
add-content $PartitionSize "<tr bgcolor='#CCCCCC'>"
add-content $PartitionSize "<td colspan='3' height='25' align='center'>"
add-content $PartitionSize "<font face='tahoma' color='#003399' size='4'><strong>Enterprise Vault Store Open Partition Size Monitor - $date</strong></font>"
add-content $PartitionSize "</td>"
add-content $PartitionSize "</tr>"
add-content $PartitionSize "</table>"
Function writememInfo
{
param($fileName,$server, $FolderName, $Size)
Add-Content $fileName "<tr>"
Add-Content $fileName "<td>$server</td><td>$FolderName</td>"
If ("$Size" -gt "100")
{
Add-Content $fileName "<td bgcolor='#086105' align=center>$Size</td>"
}
Else
{
Add-Content $fileName "<td bgcolor='#FF6B17' align=center>$Size</td>"
}
Add-Content $fileName "</tr>"
}
Function AddObject {
Param ($FileObject, $FolderRef)
$Size = [double]($FSO.GetFolder($FileObject.FullName).Size)
$Script:TotSize += $Size
If ($Size)
{ $SizeInGB = CalculateSize $Size
}
Else
{ $SizeInGB = "0.00"
$Size = 0
}
$Script:Report += New-Object PSObject -Property @{
'Folder Name' = $FileObject.FullName
Size = $SizeInGB
}
writememInfo $PartitionSize $server $Folder $Report.Size
}
Function CalculateSize {
Param ([double]$Size)
If ($Size -gt 10000)
{ $ReturnSize = "{0:N2}" -f ($Size / 1GB)
}
Else
{ $ReturnSize = .01
}
Return $ReturnSize
}
Add-Content $PartitionSize "<table width='55%'><tbody>"
Add-Content $PartitionSize "<tr bgcolor='#CCCCCC'>"
Add-Content $PartitionSize "<td width='55%' align='center' colSpan=3><font face='tahoma' color='#003399' size='2'><strong> $evsite </strong></font></td>"
Add-Content $PartitionSize "</tr>"
writeTableMemHeader $PartitionSize
foreach($server in $serverlist)
{
$localhost = Get-content env:computername
if ($server -ne $localhost)
{
$FolderList = Invoke-Command -ComputerName $server -ScriptBlock {
Import-Module "C:\Program Files (x86)\Enterprise Vault\Symantec.EnterpriseVault.PowerShell.Core.dll"
Get-EVVaultStorePartition | Where {$_.Status -eq "Open"}
}
$FolderList = $FolderList.Location
}
else
{
$FolderList = Get-EVVaultStorePartition | Where {$_.Status -eq "Open"}
$FolderList = $FolderList.Location
}
foreach($Folder in $FolderList)
{
$Report = @()
$TotSize = 0
$FSO = New-Object -ComObject Scripting.FileSystemObject
$UNCFolder = $Folder.Replace(':','$')
$UNCFolder = "\\" + $server+ "\" + $UNCFolder
$DirPath = Get-Item -Path $UNCFolder
AddObject $DirPath $Folder
}
}
writeHtmlFooter $PartitionSize
#Sending Email
$subject = "Attention: Enterprise Vault HEALH CHECK REPORT"
$body = Get-Content $PartitionSize
$smtp= New-Object System.Net.Mail.SmtpClient $smtphost
$msg = New-Object System.Net.Mail.MailMessage $from, $to, $subject, $body
$msg.isBodyhtml = $true
$smtp.send($msg)
Share your experience!
Note - Test before you apply on production server.
-Praveen