cb-net.co.uk

...WinTel Admin Simplified

  • Increase font size
  • Default font size
  • Decrease font size

VMWare : VCB Cleanup Script

E-mail Print PDF

VMWare : VCB Cleanup Script

VCB is a powerful and useful technology for backing up Virtual Machines running on ESX/vSphere, more than once it has rescued an entire Virtual Machin where a standalone server would have had to be rebuilt.

My only fault with the 'vanilla' installation is the cleanup process. Whena  VCB backup fails, or even succeeds at times, the snapshot is not cleaned up on the VCB proxy server or the ESX host. This can result in wastedstorage on both systems.

VCB includes a cleanup script which will clean directories in the VCB root folder as specified in the following file: C:\Program Files\VMware\VMware Consolidated Backup Framework\config\config.js

This script works well at cleaning up folders for VCB that are created dynamically in the root folder, however, if you have created subdirectories for per-VCB tasks the script will not automatically cleanup the VCB snapshots. I create a sub-folder on a per-VCB basis, why? This is simple,. because using HP dataprotector to perform VCB backups I have to specify a folder that exists tobackup to tape. If I specify the VCB root folder then if a VCB fails and the data is not cleaned up, the next VCB will be significantly larger as it will contain the data for the failed VCB snapshot and the new VCB snapshot.

I have around 50 VM's, therefore manually editing the VCB config.js file to reflect the root VCB directory for each backup was a no-no.

You'll find a link below to a modified version of the vcb-cleanup.wsf file included with the VCB proxy package. Copy this file to the 'C:\Program Files\VMware\VMware Consolidated Backup Framework\generic' directory.

Modify the  C:\Program Files\VMware\VMware Consolidated Backup Framework\config\config.js file to reflect the root cotainer for all of your VCB folders.

Follow the steps outlined below to perform VCB cleanup on all subfolders:

  1. Ensure no VCB backups are in progress
  2. Open a command prompt, cd to  "C:\Program Files\VMware\VMware Consolidated Backup Framework\generic"
  3. Execute the following command "cscript.exe vcb-cleanup-mod.wsf "C:\Program Files\VMware\VMware Consolidated Backup Framework"  -y"
Download the script from here. Not, you will need to rename the file from '.txt' to '.wsf'
Last Updated on Monday, 25 January 2010 09:31
 

SQL 2008 : “Invoke or BeginInvoke" SP1 Error

E-mail Print PDF

SQL 2008 : “Invoke or BeginInvoke" SP1 Error

I recently came across an error when installing SP1 on a Windows 2008 R2 x64/SQL 2008 Standard x64 environment which prevened me from installing the service pack:

“Invoke or BeginInvoke cannot be called on a control until the window handle has been created."

As a work around I identified that I was able to right-click the update and select 'Run as Administrator.' I was then able to complete the update without issue.

Last Updated on Monday, 18 January 2010 22:25
 

Exchange 2007 : Mailbox Statistics and Storage Quotas

E-mail Print PDF

Exchange 2007 : Mailbox Statistics and Storage Quotas

Usethe following Exchange Shell command to list all mailboxes, sorted by size

get-mailbox | Get-MailboxStatistics |  Select @{n="DisplayName";e={$_.DisplayName}}, StorageGroupName,@{e={$_.TotalDeletedItemSize.Value.ToMB()};n="TotalDeletedItemsSize(MB)"}, DeletedItemCount, @{e={$_.TotalItemSize.Value.ToMB()};n="TotalItemSize(MB)"}, ItemCount, StorageLimitStatus | Sort-Object "TotalItemSize(MB)" | ft

Use the following command to list all mailboxes with a StorageQuotaStatus of 'ProhibitSend'

get-mailbox  | Get-MailboxStatistics | where-object {$_.StorageLimitStatus -eq "ProhibitSend"} |  Select @{n="DisplayName";e={$_.DisplayName}}, StorageGroupName,@{e={$_.TotalDeletedItemSize.Value.ToMB()};n="TotalDeletedItemsSize(MB)"}, DeletedItemCount, @{e={$_.TotalItemSize.Value.ToMB()};n="TotalItemSize(MB)"}, ItemCount, StorageLimitStatus | Sort-Object "TotalItemSize(MB)" | ft

Alternately you can export the results to a CSV file using the following command:
get-mailbox | Get-MailboxStatistics | where-object {$_.StorageLimitStatus -eq "ProhibitSend"} |  Select @{n="DisplayName";e={$_.DisplayName}}, StorageGroupName,@{e={$_.TotalDeletedItemSize.Value.ToMB()};n="TotalDeletedItemsSize(MB)"}, DeletedItemCount, @{e={$_.TotalItemSize.Value.ToMB()};n="TotalItemSize(MB)"}, ItemCount, StorageLimitStatus | Sort-Object "TotalItemSize(MB)" | Export-Csv C:\mailbox_stats.csv
The following options are available as StorageQuotaStatus:
  • IssueWarning
  • BelowLimit
  • ProhibitSend
  • MailboxDisabled
  • NoChecking
Simply modifiy the command as follows to change the data returned by the command:
get-mailbox | Get-MailboxStatistics | where-object {$_.StorageLimitStatus -eq "IssueWarning"} |  Select @{n="DisplayName";e={$_.DisplayName}}, StorageGroupName,@{e={$_.TotalDeletedItemSize.Value.ToMB()};n="TotalDeletedItemsSize(MB)"}, DeletedItemCount, @{e={$_.TotalItemSize.Value.ToMB()};n="TotalItemSize(MB)"}, ItemCount, StorageLimitStatus | Sort-Object "TotalItemSize(MB)" | Export-Csv C:\mailbox_stats.csv
Last Updated on Friday, 15 January 2010 11:42
 

Powershell : Export Active Directory Group Members

E-mail Print PDF

Powershell : Export Active Directory Group Members

First you will need to obtain the 'ActiveRoles Management Shell for Active Directory' from the following link: http://www.quest.com/powershell/activeroles-server.aspx

Next save the following code into a new '.ps1' script file:

$data = @()
foreach ($grp in Get-QADGroup -SearchRoot "internal.local/UK" | select-object Name,DN ) {$data += get-qadgroupmember -identity $grp.DN | select @{n="GroupName";e={$grp.Name}},@{n="GroupDN";e={$grp.DN}},Name,@{n="DistinguishedName";e={$_.DN}},type}

$data | sort-object "GroupName" | export-csv C:\UK_GroupExport.csv

Modify the search root so that it reflects the domain name/OU you wish to enumerate groups and group members from. This should be in canonical form, for example "my.domain/myOU".

On execution, this script will create a new csv file containing groups and all members, including nested groups.

Last Updated on Wednesday, 24 February 2010 22:44
 

Exchange 2007 : Purge Outbox Script

E-mail Print PDF

Exchange 2007 : Purge Outbox Script

I recently cam across an issue where users email was getting 'stuck' in their Outbox, despite being sent to the intended recipient. Some users had approx 95% of the mailbox Send limit in stuck email, so this problem was affecting their ability to work.

The following script helped me to identify that approx 4GB of data was stuck in user Outboxes across my Exchange environment. This will genetrate a CSV file containing the Outbox size for every mailbox in the Exchange Org. Save the following code to a '.ps1' file and call from the Exchange Shell:

$data = @()
foreach($mbx in Get-Mailbox -ResultSize unlimited) { $data += Get-MailboxFolderStatistics $mbx.identity -FolderScope 'Outbox' | select @{n="DisplayName";e={$mbx.DisplayName}},FolderPath,ItemsInFolder,@{n="FolderSize(MB)";e={$_.folderSize.toMB()}}}

$data | sort-object "FolderSize(MB)" –Descending | export-csv c:\Outbox_sizes.csv

Once I had identified the severity of the issue I wrote the following power shell script to purge all user Outboxes, exporting the to a PST file in case of any repercussion, note you will have to create the intended export folder prior to running this scrip. As before, copy the following command into a  ' .ps1' file and execute from the Exchange Shell:

foreach($mbx in Get-Mailbox -ResultSize unlimited){ Export-Mailbox -Identity $mbx.identity -IncludeFolders "\Outbox" -PSTFolderPath "C:\OutboxExport\" -DeleteContent -BadItemLimit 1000 -confirm:$false }

 


Page 4 of 6