Skip to content

Instantly share code, notes, and snippets.

View dlinsley's full-sized avatar

Daniel Linsley dlinsley

  • Broadcom - Tanzu
  • SMF
View GitHub Profile
@dlinsley
dlinsley / hot_relocate_vm.js
Created November 25, 2017 05:35
Hot relocate a vSphere VM to different compute and storage
// VMware vRealize Orchestrator (vRO) action sample
//
// Relocates a VM when hosts do not share storage.
// Tested with vSphere 6.0. Does not require VM to be powered off
//
// For vRO/vRA 7.0+
//
// Action Inputs:
// vm - VC:VirtualMachine
// datastore - VC:Datastore
@dlinsley
dlinsley / find_duplicate_objects.py
Last active September 28, 2023 17:18
Find duplicate objects in an aws s3 bucket by comparing ETag
#!/usr/bin/env python3
import boto3
import argparse
import string
parser = argparse.ArgumentParser('Find duplicate objects in an aws s3 bucket')
parser.add_argument('--bucket', dest='myBucket', default='yourBucketName', help='S3 Bucket to search')
cliArgs = parser.parse_args()
@dlinsley
dlinsley / change_storage_class.py
Last active June 27, 2022 06:25
aws s3 bucket change storage class by object size
import boto3
import argparse
import string
parser = argparse.ArgumentParser('Change storage class of s3 objects')
parser.add_argument('--bucket', dest='myBucket', default='yourBucketName', help='S3 Bucket to search')
parser.add_argument('--from', dest='fromPath', default='', help='s3 path to start search from')
cliArgs = parser.parse_args()
@dlinsley
dlinsley / replaceCertEmbedPSC_vROguestScriptManager_1.js
Created September 19, 2017 21:20
Replace machine certificate with CA signed certificate on vCenter Appliance 6.5 with embedded PSC without using the vSphere Certificate Manager Utility using vRO Guest Script manager
//Scriptable Tasks Inputs:
//
//
//Scriptable Tasks Outputs:
//
// script - String - script to execute with guest script manager
script = "/usr/lib/vmware-vmafd/bin/vecs-cli entry getcert --store MACHINE_SSL_CERT --alias __MACHINE_CERT --output /usr/lib/vmware-vmafd/bin/original.crt\n";
script += "/usr/bin/openssl x509 -in /usr/lib/vmware-vmafd/bin/original.crt -noout -sha1 -fingerprint | /usr/bin/cut -d= -f 2";
@dlinsley
dlinsley / replaceCertificateEmbeddedPSC.sh
Last active March 18, 2019 20:07
Replace machine certificate with CA signed certificate on vCenter Appliance 6.5 with embedded PSC without using the vSphere Certificate Manager Utility in a shell script
#!/bin/bash
#
# In the local directory 3 files are required
# new_cert.crt - new machine certificate
# new_cert.key - private key for certificate
# intermediary.crt - certificate chain of the signing authority for new_cert.crt
#
# Run commands on the vCSA shell:
# import intermediary authority cert:
@dlinsley
dlinsley / assignHostLicenseKey.js
Created August 6, 2017 21:08
Assign license to ESXi HostSystem
// VMware vRealize Orchestrator (vRO) action sample
//
// Assign license key to ESXi Host (HostSystem)
//
// For vRO v7.0+
//
// Action Inputs:
// host - VC:HostSystem
// license - string
//
@dlinsley
dlinsley / attachExistingVMDK.js
Last active July 17, 2017 19:10
Attach existing VMDK disk to vCenter VM
// VMware vRealize Orchestrator (vRO) action sample
//
// Attach existing VMDK disk to vCenter VM
//
// For vRO/vRA 7.0+
//
// Action Inputs:
// vcVm - VC:VirtualMachine
// diskPath - string
//
@dlinsley
dlinsley / getSoftwareComponentPropertyIds.js
Created June 20, 2017 00:39
Get Software Component Property IDs
// VMware vRealize Orchestrator (vRO) action sample
//
// Get IDs of Properties of a Software Component
//
// For vRO/vRA 7.0+
//
// Action Inputs:
// host - vCACCAFE:VCACHost
// componentId - string
//
@dlinsley
dlinsley / getSoftwareComponentPropertyDetails.js
Last active June 20, 2017 13:31
Get vRA Software Component Property Details
// VMware vRealize Orchestrator (vRO) action sample
//
// Get details about at Software Component Property
//
// For vRO/vRA 7.0+
//
// Action Inputs:
// host - vCACCAFE:VCACHost
// componentId - string
// propertyId - string
@dlinsley
dlinsley / getVcVirtualMachineFromVcacVirtualMachine.js
Last active September 25, 2018 15:57
Get vCenter VirtualMachine from vRA VirtualMachine
// VMware vRealize Orchestrator (vRO) action sample
//
// Returns the vCenter VM for a vCAC/vRA VM
//
// For vRO/vRA 7.0+
//
// Action Inputs:
// vCACVm - vCAC:VirtualMachine
//
// Return type: VC:VirtualMachine