In my previous post, I have shared a script to Monitor Enterprise Vault Partition Growth / Size. If you are using that, it will be easy for you to understand this script as well. As you are aware, many of us run the pre and post backup script to make the EV servers ready for backup mode and release it. These scripts are normally scheduled or ran by the backup software. Regardless of the way it ran, the script provide a little information to the administrators about the status of store and index backup mode status.

This script is written to capture the backup mode status of all available store and Index location. You may schedule this script to run at a specified time, and verify the status at a glance and thus avoid regular check by logging into the EV server/Console.

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.

Download the Script Here

The Full Script:

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"

$BkpFile = "C:\Scripts\HTML\Backup_Mode.htm" #Change the Value

$serverlist = (Get-EVComputers | select ComputerNameAlternate).ComputerNameAlternate

$evsite = (Get-EVSite | select Name).Name

$ModeValue = "False"

$date = ( Get-Date ).ToString('yyyy/MM/dd - hh:mm')

$smtphost = "yourSMTP_Server" #Change the Value

$from = "This email address is being protected from spambots. You need JavaScript enabled to view it." #Change the Value

$to = "This email address is being protected from spambots. You need JavaScript enabled to view it." #Change the Value

New-Item -ItemType file $BkpFile -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 writeTableMemHeader

{

       param($fileName)

       Add-Content $fileName "<tr bgcolor=#B0AE5B>"

       Add-Content $fileName "<td width='10%' align='center'>Server/Site Name</td>"

       Add-Content $fileName "<td width='30%' align='center'>Index Location</td>"

       Add-Content $fileName "<td width='15%' align='center'>Backup Mode Status</td>"

       Add-Content $fileName "</tr>"

}

Function writeTableMemHeader2

{

       param($fileName)

       Add-Content $fileName "<tr bgcolor=#B0AE5B>"

       Add-Content $fileName "<td width='10%' align='center'>Server/Site Name</td>"

   Add-Content $fileName "<td width='30%' align='center'>Vault Store</td>"

   Add-Content $fileName "<td width='15%' align='center'>Backup Mode Status</td>"

       Add-Content $fileName "</tr>"

}

Function writeHtmlFooter

{

       param($fileName)

   Add-Content $fileName "</body>"

   Add-Content $fileName "<br/><br/>"

       Add-Content $fileName "</html>"

}

Function writememInfo

{

       param($fileName,$server, $IndexPath, $bkpmode)

      

       Add-Content $fileName "<tr>"

       Add-Content $fileName "<td>$server</td><td>$IndexPath</td>"

       If ("$bkpmode" -eq "False")

       {

              Add-Content $fileName "<td bgcolor='#086105' align=center>OFF</td>"

       }

       Else

       {

              Add-Content $fileName "<td bgcolor='#FF6B17' align=center>ON</td>"

       }            

       Add-Content $fileName "</tr>"

}

writeHtmlHeader $BkpFile

   add-content $BkpFile "<table width='55%'>"

       add-content $BkpFile "<tr bgcolor='#CCCCCC'>"

       add-content $BkpFile "<td colspan='3' height='25' align='center'>"

       add-content $BkpFile "<font face='tahoma' color='#003399' size='4'><strong>Enterprise Vault Backup Mode Monitor - $date</strong></font>"

       add-content $BkpFile "</td>"

       add-content $BkpFile "</tr>"

       add-content $BkpFile "</table>"

foreach ($server in $evsite)

{

       Add-Content $BkpFile "<table width='55%'><tbody>"

       Add-Content $BkpFile "<tr bgcolor='#CCCCCC'>"

       Add-Content $BkpFile "<td width='55%' align='center' colSpan=3><font face='tahoma' color='#003399' size='2'><strong> $server </strong></font></td>"

       Add-Content $BkpFile "</tr>"

       writeTableMemHeader $BkpFile

       $indexs = Get-IndexLocationBackupMode $server -EVSiteName archival | select-object indexrootpath, backupmode

       foreach ($index in $indexs) {

              $IndexPath = $index.IndexRootPath

              $bkpmode = $index.BackupMode

      

       writememInfo $BkpFile $server $IndexPath $bkpmode

       }

       #Add-Content $BkpFile "</table>"

  

   writeTableMemHeader2 $BkpFile

   $stores = Get-VaultStoreBackupMode -EVServerName $server -Name archival -EvObjectType Site | select-object VaultStoreName, BackupMode

       foreach ($store in $stores) {

              $storename = $store.VaultStoreName

              $bkpmode = $store.BackupMode            

      

       writememInfo $BkpFile $server $storename $bkpmode

       }

   Add-Content $BkpFile "</table>"

}

Writehtmlfooter $BkpFile

#Sending Email

   $subject = "Attention: Enterprise Vault HEALH CHECK REPORT"

   $body = Get-Content $BkpFile

   $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)

   # --------- Script Ends ----------------

Download the Script Here

Share your experience!

-Praveen

Published in Solutions

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.

Download the Script Here

The Full Script:

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)

Download the Script Here

Share your experience!

Note - Test before you apply on production server.

-Praveen

Published in Solutions
theme by reviewshub