Skip to content

Instantly share code, notes, and snippets.

@vmwarecode
vmwarecode / snippet.sh
Created March 8, 2017 05:26
macOS - Custom Attributes for McAfee Endpoint for Mac
## NOTE: Adapted from https://github.com/tziegmann ##
## McAfee-IsManaged ##
isManaged=`sudo /Library/McAfee/agent/bin/cmdagent -i | grep GUID | cut -c 7-43`
if [ $isManaged != "N/A" ] ;
then
result="Managed"
else
@vmwarecode
vmwarecode / snippet.sh
Created March 8, 2017 05:06
macOS - Common System Information Custom Attributes
## SIP-STATUS ##
csrutil status | awk '{print toupper($5)}' | sed 's/\.//g'
## OS-MINORBUILDVERSION ##
/usr/bin/sw_vers -buildVersion
@vmwarecode
vmwarecode / snippet.sh
Created March 8, 2017 04:57
macOS - Custom Attributes to discover Microsoft Office 2016 for Mac versions
## WORD-VERSION ##
if [ -x "/Applications/Microsoft Word.app" ]; then /usr/bin/defaults read /Applications/Microsoft\ Word.app/Contents/Info.plist CFBundleShortVersionString ; else echo "0.0"; fi
## EXCEL-VERSION ##
if [ -x "/Applications/Microsoft Excel.app" ]; then /usr/bin/defaults read /Applications/Microsoft\ Excel.app/Contents/Info.plist CFBundleShortVersionString ; else echo "0.0"; fi
## ONENOTE-VERSION ##
if [ -x "/Applications/Microsoft OneNote.app" ]; then /usr/bin/defaults read /Applications/Microsoft\ OneNote.app/Contents/Info.plist CFBundleShortVersionString ; else echo "0.0"; fi
## POWERPOINT-VERSION ##
@vmwarecode
vmwarecode / snippet.js
Created February 22, 2017 21:32
Remove string from array of strings by value
// VMware vRealize Orchestrator action sample
//
// Removes a string from an array of strings by value.
// Does not account for duplicate values in the array.
//
//Action Inputs:
// aStrings - Array/String
// toRemove - String
//
//Return type: Array/String
@vmwarecode
vmwarecode / snippet.js
Created February 22, 2017 21:15
Find vCAC_VirtualMachine object for VC_VirtualMachine object
// Copyright 2017, VMware, Inc. All Rights Reserved
//
// VMware vRealize Orchestrator action sample
//
// Finds a vCAC:VirtualMachine object corresponding to a VC:VirtualMachine object.
//
//
//Action Inputs:
// vm - VC:VirtualMachine
//
@vmwarecode
vmwarecode / snippet.js
Last active April 10, 2022 13:21
Email Base64 encoded PDF file from Orchestrator
// Copyright 2016, VMware, Inc. All Rights Reserved
//
// VMware vRealize Orchestrator action sample
//
// Email Base64 encoded PDF file from Orchestrator
//
// This sample takes a base64 encoded PDF from a web service and attaches
// it to an email message with vRealize Orchestrator.
//
// Currently this sample requires enabling local process execution.
@vmwarecode
vmwarecode / snippet.js
Created December 11, 2016 23:01
Get Distributed Virtual Portgroup from Managed Object Reference Id
// Copyright 2016, VMware, Inc. All Rights Reserved
//
// VMware vRealize Orchestrator action sample
//
// Given a Managed Object Reference Id of a DistributedVirtualPortgroup
// (ex: dvportgroup-714) return the VC:DistributedVirtualPortgroup object.
//
//Action Inputs:
// id - string
//
@vmwarecode
vmwarecode / snippet.js
Created December 9, 2016 22:43
Decode vSphere License
// Copyright 2016, VMware, Inc. All Rights Reserved
//
// VMware vRealize Orchestrator action sample
//
// Decodes the 'Product Name' and 'Product Version' from a vSphere license string.
// Also does some basic license key format validation
//
//Action Inputs:
// vCenterConnection - VC:SdkConnection
// licenseKey - string
@vmwarecode
vmwarecode / snippet.ps1
Created November 22, 2016 11:09
Set the VSAN.DefaultHostDecommissionMode on all hosts in a cluster
########################################
# Synopsis: Set the Host Decommission Mode on all hosts in a cluster
# Author: Greg Mulholland
# Version: 1.0
# Disclaimer: This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY
$message = write-host "This script will set the Host Decommission Mode to be used when entering Maintenance Mode." -fore cyan
@vmwarecode
vmwarecode / snippet.ps1
Created November 10, 2016 18:27
Get SHA1 thumbprint of remote https server
#
# Fetches a https certificate from a url and
# returns the SHA1 thumbprint of the certificate with PowerShell
#
#example uri: https://vcenterhost.corp.local:443
#returns something similar to: EF:FF:EB:D5:F8:89:89:1E:96:A3:6D:05:D9:D6:1B:45:23:DB:9B:3C
#
param([parameter(Mandatory=$true)][uri]$uri)