Skip to content

Instantly share code, notes, and snippets.

View virtualhobbit's full-sized avatar
:octocat:
Building clouds

Mark Brookfield virtualhobbit

:octocat:
Building clouds
View GitHub Profile
System.log("Updating VirtualMachineName to '" + inVM + "'.");
//Get the properties of the vRA VM Entity object
var vmEntityProps = inVMEntity.getProperties();
//Change the VirtualMachineName property by deleting it and re-adding it
vmEntityProps.remove('VirtualMachineName');
vmEntityProps.put('VirtualMachineName', inVM);
//Update the Entity object to save the change
// Retrieve the virtual machine properties
var machine = payload.get("machine");
// Check the machine's properties exist
if (machine !== null) {
// Retrieve the values
var attVirtualMachineId = machine.get("id");
}
// Get the hostname generated by vRA
<?xml version="1.0" encoding="utf-8" ?>
<CustomDataType>
<Data Name="Utrecht" Description="Utrecht, NL"/>
<Data Name="Southport" Description="Southport, UK"/>
</CustomDataType>
var category = Server.getConfigurationElementCategoryWithPath(inConfigurationElementPath);
var elements = category.configurationElements;
for each ( var element in elements) {
if (element.name == inConfigurationElementName) {
var configurationElement = element;
}
}
var result = (configurationElement.getAttributeWithKey(inName).value);
var category = Server.getConfigurationElementCategoryWithPath(inConfigurationElementPath);
var elements = category.configurationElements;
for each ( var element in elements) {
if (element.name == inConfigurationElementName) {
var configurationElement = element;
}
}
configurationElement.setAttributeWithKey(inName, inValue);
# Install the certificate
certutil -f -p $certPass -ImportPfx $cert
# Retrieve the certificate details
Set-Location -Path cert:\LocalMachine\My
$myCert = Get-ChildItem | Where-Object { $_.Subject -match "\*.hobbitcloud.com" }
# Configure friendly name for Horizon
$tp = $myCert.Thumbprint
(Get-ChildItem -Path Cert:\LocalMachine\My\$tp).FriendlyName = "vdm"
<#
.SYNOPSIS
Uploads freshly minted certs to Horizon UAG
.DESCRIPTION
Generates an SSL certificate from Let's Encrypt, then connects to each UAG using the REST API and applies the certificate to the Internet interface. The Admin interface (port 9443) is unaffected.
.PARAMETER dnsName
The public DNS name of the UAG
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"route53:ListHostedZones",
"route53:GetChange"
],
"Resource": [
$ErrorActionPreference = "Stop"
$url = "https://download.sysinternals.com/files"
$zip = "SDelete.zip"
$exe = "sdelete64.exe"
$arg = "-z c: /accepteula"
# Get SDelete
Invoke-WebRequest -Uri ($url + "/" + $zip) -OutFile C:\$zip
$ErrorActionPreference = "Stop"
$webserver = "webserver.contoso.local"
$url = "http://" + $webserver
$files = @("VMwareOSOptimizationTool.exe","VMwareOSOptimizationTool.exe.config","my_osot.xml")
$exe = $files[0]
$arg = "-o -t " + $files[2]
# Verify connectivity
if (Test-Connection $webserver -Quiet){