Skip to content

Instantly share code, notes, and snippets.

View rbocchinfuso's full-sized avatar

Richard Bocchinfuso rbocchinfuso

View GitHub Profile
@rbocchinfuso
rbocchinfuso / check_vm_snaps.ps1
Last active March 8, 2018 12:31
PowerShell script to check for VM snapshots and send Email report
# PowerShell script to check for VM snapshots and send Email report
add-pssnapin VMware.VimAutomation.Core
Connect-VIServer -Server 'vcenter' -User 'domain\user' -Password 'password'
# HTML formatting
$a = "<style>"
$a = $a + "BODY{background-color:white;}"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 5px;border-style: solid;border-color: black;foreground-color: black;background-color: LightBlue}"
@rbocchinfuso
rbocchinfuso / rp_cg_rep_stats.sh
Created March 5, 2014 15:41
Quick shell script to quickly gather a CSV with RP CG replication stats
RP="192.168.100.101"
out="./cg_stats.out"
groups="./groups.in"
#plink -l admin -pw admin $RP "get_groups" | egrep -v "Production|DRSite|Copies|Groups" | sed -e '/^$/d' | awk -F\: '{print $1}' | sed '$d' > $GroupTmp
echo "CGName,JournalUsage,JournalLag,ReplicationLag,CurrentProtectionWindow,PredictedProtectionWindow"
echo "CGName,JournalUsage,JournalLag,ReplicationLag,CurrentProtectionWindow,PredictedProtectionWindow" > $out
for name in `cat $groups`; do
#JournalTotal=`plink -l admin -pw admin $RP "get_group_statistics $name" | egrep "Total:" | tail -n1 | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}'`
@rbocchinfuso
rbocchinfuso / 0_reuse_code.js
Created March 5, 2014 17:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rbocchinfuso
rbocchinfuso / check_datastore_cap.ps1
Created March 6, 2014 20:27
Datastore Capacity Report
#PowerShell script to check datastore capacity
add-pssnapin VMware.VimAutomation.Core
Connect-VIServer -Server 'vcenter' -User 'domain\user' -Password 'password'
#HTML formatting
$a = "<style>"
$a = $a + "BODY{background-color:white;}"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 5px;border-style: solid;border-color: black;foreground-color: black;background-color: LightBlue}"
@rbocchinfuso
rbocchinfuso / cleanup_snaps.ps1
Created March 6, 2014 21:59
Cleanup VM snapshots older than N days and prefixed with Y
Get-VM | Get-Snapshot -Name foo* | Where { $_.Created -lt (Get-Date).AddDays(-2)} | remove-snapshot -confirm:$false
@rbocchinfuso
rbocchinfuso / vnxsnap.bat
Created September 9, 2014 19:09
Simple EMC VNX Snap Script
@echo off
rem VNX Snapshot Script
rem vnxsnap.bat
rem Rich Bocchinfuso 2014-09-09
rem set variables
set ver=0.1
set cmd=vnxsnap
set spa=10.12.3.17
set spb=10.12.3.18
@rbocchinfuso
rbocchinfuso / ddreport.bat
Created September 30, 2014 16:31
Data Domain Report
ECHO ON
@echo off
:: DD Report Generator
:: 3/12/2014
:: Rich Bocchinfuso
::setlocal EnableDelayedExpansion
:: ----- Requires -----
:: plink
:: blat
@rbocchinfuso
rbocchinfuso / ghettoVCBmgmt.bat
Last active August 29, 2015 14:07
ghettoVCB managment script
ECHO ON
@echo off
:: ghettoVCB Management
:: 3/12/2014
:: Rich Bocchinfuso
::setlocal EnableDelayedExpansion
:: ----- Requires -----
:: plink
:: blat
@rbocchinfuso
rbocchinfuso / nwgetclientss.pl
Created September 30, 2014 16:33
NetWorker Get Client SaveSets
#!/usr/bin/perl
BEGIN { eval { require bytes; }; }
use strict;
no strict "vars";
## Switch will be used to test the field value and build the csv file
use Switch;
use Data::Dumper;
@rbocchinfuso
rbocchinfuso / parsemminfoxml.pl
Created September 30, 2014 16:33
Parse mmifo xml output
#!/opt/ActivePerl-5.16/bin/perl
use XML::Simple;
use Data::Dumper;
use IO::File;
open (OUTFILE, '>parsed_mminfo.csv');
print OUTFILE "filename,client,name,level,sum-size\n";
# create object
$xml = new XML::Simple (KeyAttr=>[]);