Updates from April, 2012

  • 9:10 am on April 27, 2012 Permalink

    I’ve come up with this Windows PowerShell script to help identify virtual machines that have snapshots older than 1 day. It generates a CSV file and emails specified recipients. This is particularly handy in large VMware environments where snapshots can cause major havoc on datastore utilization. Enjoy!

    
    # ==============================================================================================
    # NAME: vmwaresnapreport.ps1
    # AUTHOR: Eric Kiel erickielcollideoscopeorg
    # DATE  : 4/27/2012
    # COMMENT: This script will connect to a VMware Virtual Center server and report on VMs with snapshots
    # that are older than 1 day.
    # VERSION: 1.0 - Original Code
    # USAGE: .\vmwaresnapreport.ps1
    # Variables: 
    # $vcenter - vCenter host name
    # $vcenterdomain - domain that vCenter resides in; yourdomain.com
    # $mailserver - SMTP Mail relay
    # $email1 - Distribution list or email address to send report to
    # $email2 - 2nd distribution list or email address for reporting
    # REQUIREMENTS: VMware vSphere PowerCLI
    # ==============================================================================================
    
    #Initialize Variables
    $vcenter = "YOUR VCENTER HOST NAME"
    $vcenterdomain = "VCENTER DOMAIN"
    $mailserver = "YOUR SMTP SERVER"
    $email1 = "YOUR DISTRIBUTION LIST OR EMAIL ADDRESS"
    $email2 = "DISTRIBUTION LIST 2 OR ANOTHER EMAIL ADDRESS"
    
    # Enable VMware Snap-in
    add-pssnapin VMware.VimAutomation.Core
    
    $date = get-date -format MM-dd-yyyy
    connect-viserver $vcenter
    Get-VM | Get-Snapshot | Where { $_.Created -lt (Get-Date).AddDays(-1)} | select VM, Name, Description, Created, PowerState, SizeMB | export-csv $date-$vcenter-snapshots.csv -notypeinformation
    send-mailmessage -from "$vcenter@$vcenterdomain" -to "$email1", "$email2" -subject "$vcenter Snapshot Report for $date" -attachment "$date-$vcenter-snapshots.csv" -body "Snapshot report for $vcenter generated on $date" -smtpserver $mailserver
    

    Download vmwaresnapreport and rename to .ps1 to run with PowerShell.

     
  • 7:56 pm on April 4, 2012 Permalink

    Just over a year. That is far too long to let this site sit and go to waste. I’m in the process of cooking up some articles so look forward to them as I’ve learned a lot in the past year. I’ve moved all of my projects to erickiel.com so go check them out. I’m also working on an update to the OpenNote theme – look forward to better code handling as well as a darker theme that is easier on the eyes and inspired by Crunchbang. See you soon!

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel