Skip to content

Instantly share code, notes, and snippets.

View johnddias's full-sized avatar
:octocat:
Being fabulous!

John Dias johnddias

:octocat:
Being fabulous!
View GitHub Profile
@johnddias
johnddias / addUserToLocalAdmin.vbs
Last active August 29, 2015 13:56
Add User To Local Admin
Dim objFSO, logFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set logFile = objFSO.OpenTextFile("C:\scripts\addgroup.log", 2, True)
Set objWshNet = CreateObject("WScript.Network")
computerName= objWshNet.ComputerName
logFile.WriteLine "Computer Name: " & computerName
Dim fullUpn
@johnddias
johnddias / addGroupToLocalAdmin.vbs
Created February 9, 2014 16:43
vCAC Automate Local Admin permissions with AD Security Group
Dim objFSO, logFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set logFile = objFSO.OpenTextFile("C:\scripts\addgroup.log", 2, True)
Set objWshNet = CreateObject("WScript.Network")
computerName= objWshNet.ComputerName
logFile.WriteLine "Computer Name: " & computerName
Dim fullUpn
var launchedFrom = eventPayloadProperties.get("lifecycleState");
externalWFStub=launchedFrom.get("state")+":"+launchedFrom.get("phase");
virtualMachineEntity=System.getModule("com.vmware.library.vcac").getVirtualMachineEntity(vCACHost,vcacVm);
var vCenterVms=System.getModule("com.vmware.library.vc.vm").getAllVMs();
for (vm in vCenterVms) {
if (vm.id==machineProp.get("externalReference") && machineProp.get("externalReference")) {
vCenterVm=vm;
break;
}
}
@johnddias
johnddias / Dockerfile
Created March 29, 2017 15:17
Dockerfile for Webhook-Shims container
FROM photon:latest
MAINTAINER John Dias "diasj@vmware.com"
RUN tdnf install python2 python-xml -y \
&& curl -s https://bootstrap.pypa.io/get-pip.py > /tmp/get-pip.py \
&& /usr/bin/python /tmp/get-pip.py \
&& tdnf install git -y \
&& git clone https://github.com/vmw-loginsight/webhook-shims.git ~/webhook-shims
WORKDIR /root/webhook-shims
RUN /usr/bin/pip install -r requirements.txt
#ENTRYPOINT ["python"]
@johnddias
johnddias / SDMPTSdashboard.json
Created May 11, 2017 12:30
vROps Service Discovery Management Pack Discovery Issues Dashboard
{
"dashboards": [{
"autoswitchEnabled": false,
"columnCount": 1,
"columnProportion": "1",
"creationTime": 1492613965544,
"description": "",
"disabled": false,
"id": "8abb8f61-f123-4ca4-8c56-dcfcaaa0aa17",
"importAttempts": 0,
@johnddias
johnddias / gist:ba8d716b1ca108db8d2194bed0056411
Created May 11, 2017 12:35
SDMP Scoreboard Metric Config
<?xml version="1.0" encoding="UTF-8"?>
<AdapterKinds>
<AdapterKind adapterKindKey="APPLICATIONDISCOVERY">
<ResourceKind resourceKindKey="ApplicationDiscoveryAdapterInstance">
<Metric attrkey="Instance Attributes|elapsed_collect_time" label="" unit="" yellow="" orange="" red=""/>
<Metric attrkey="Instance Attributes|new_metrics" label="" unit="" yellow="" orange="" red=""/>
<Metric attrkey="Instance Attributes|new_resources" label="" unit="" yellow="" orange="" red=""/>
<Metric attrkey="Instance Attributes|observations" label="" unit="" yellow="" orange="" red=""/>
</ResourceKind>
</AdapterKind>
import requests
import json
def getAuthToken(context, inputs):
if "verify" not in inputs.keys():
inputs["verify"] = True
headers = {'Content-type':'application/json','Accept':'application/json'}
payload = {
'username':inputs["username"],
'authSource':inputs["authSource"],
@johnddias
johnddias / gist:e7375d18676612776fed9bebbeb0561c
Created June 9, 2020 10:48
Get vROps Resource ID from UUID
import requests
import json
def getResourceId(context, inputs):
if "verify" not in inputs.keys():
inputs["verify"] = True
headers = {'Content-type':'application/json','Accept':'application/json','Authorization':'vRealizeOpsToken '+ inputs["token"]}
payload = {
'propertyName':'summary|UUID',
'propertyValue':inputs["vmUUID"]