List all mailboxes set to forward externally

Quick script to get a list of all mailboxes that forward to non-authoritative domains.

$AcceptedDomains = Get-AcceptedDomain
$ExternalForwardEnabled = Get-Mailbox -Filter {ForwardingAddress -ne $null} -ResultSize Unlimited
$Results = @()
foreach ($ExternalForward in $ExternalForwardEnabled) {
    $Recipient = Get-Recipient $ExternalForward.ForwardingAddress
    if ((($Recipient).PrimarySMTPAddress).Domain -notin ($AcceptedDomains.DomainName).Domain) {
        $Object = New-Object PSObject -Property @{
            DisplayName = $(($ExternalForward).Name)
            Alias = $(($ExternalForward).Alias)
            ExternalAddress = $(($Recipient.PrimarySmtpAddress).ToString())
            ExternalDomain = $($Recipient.PrimarySmtpAddress).Domain
        $Results += $Object

$Results | Select DisplayName,Alias,ExternalAddress,ExternalDomain | Sort ExternalDomain
Continue Reading

Block Ads using dnsmasq – Synology

DNSMasq is a very light-weight DNS server that is perfectly suited to run on low power home appliances like NAS devices or routers running custom firmware.
The script below pulls ad blocking host files from 3 different providers and combines them to use as a DNSMasq resolver file.

Here is the script – it can be used verbatim on a Synology NAS running the DNSMasq package from

Edit the DNSMasq file to add an entry ‘addn-hosts’ to point to the hosts file that was just created – for example:

cd ~/AdBlock</code>

echo "# Generated on: $(date +"%D %T")" &gt; adblock

echo "Downloading file from"
wget -O yoyo;showintro=0
echo "Processing file"
cat yoyo | grep "" | awk '{ print "\t"$2 }' &gt;&gt; adblock

echo "Downloading file from"
wget -O swc
echo "Processing file"
cat swc | grep "" | awk '{ print "\t"$2 }' | grep -v "#" &gt;&gt; adblock

echo "Downloading file from"
wget -O mvps
echo "Processing file"
cat mvps | grep | grep -v "#" | awk '{ print "\t"$2 }' &gt;&gt; adblock

echo "Downloading file from HPHosts"
wget -O hphosts
echo "Processing HPHosts file"
cat hphosts | grep "" | awk '{ print "\t"$2 }' &gt;&gt; adblock

echo "Writing changes to zone file"
tr '[A-Z]' '[a-z]' &lt; adblock | sort -f | uniq &gt; adblock.uniq

echo "Reloading DNS Server"
/var/packages/dnsmasq/scripts/start-stop-status stop
/var/packages/dnsmasq/scripts/start-stop-status start
/var/packages/dnsmasq/scripts/start-stop-status status
Continue Reading

Get complete ESX Host inventory from VCenter

This is a handy little script that gives you a complete list of all hosts and some pertinent information about them including Config Issues reported by VCenter.
The script saves all this information to a CSV file and emails the contents of that file in a formatted table to the email address you specify.
Let me know if there are other parameters that you think should be in here but aren’t and I will put them in here.

Continue Reading

Find space consumed by a Thin Provisioned vmdk

Here’s some fun commands to get some stats on Thin provisioned disks.

To find out the actual space consumed on disk (in GB):

stat <filename-flat>.vmdk | grep Size: | awk '{print (($4*512)/(1024*1024*1024))}'

To find out the total space provisioned (in GB):

stat <filename-flat>.vmdk | grep Size: | awk '{print ($2/(1024*1024*1024))}'

Percent not used:

stat <filename-flat>.vmdk | grep Size: | awk '{print ((($2/(1024*1024*1024))-($4*512)/(1024*1024*1024))/($2/(1024*1024*1024)))*100}'
Continue Reading
1 2 3 15