Skip to content

Instantly share code, notes, and snippets.

@BenNeise
BenNeise / resolveCustomPropertyNametoPropertyDictionaryDisplayName.js
Created September 27, 2016 18:05
vRealize Orchestrator action to resolve a custom property using the Property Dictionary
const model = "ManagementModelEntities.svc";
const entitySet = "PropertyDefinitions";
// Create a filter, looking for a PropertyName matching our propertyName input string
var customFilterProperties = new Properties();
customFilterProperties.put("PropertyName",propertyName);
// Find all PropertyDefinition entities matching the filter
var propertyDefinitions = vCACEntityManager.readModelEntitiesByCustomFilter(
vcacVcacHost.id,
@BenNeise
BenNeise / Get-IaaSVirtualMachine.ps1
Last active August 11, 2016 14:01
PowerShell function to return vRA Virtual Machine objects via the IaaS oData interface.
function Get-IaaSVirtualMachine {
<#
.SYNOPSIS
Gets information about a virtual machine from vRA's IaaS oData interface.
.DESCRIPTION
Gets information about a virtual machine from vRA's IaaS oData interface. This includes the option to get data from linked tables.
Which includes custom properties
.PARAMETER Server
@BenNeise
BenNeise / InvokeJenkinsJobFromVcoNoParams.js
Created January 14, 2016 19:08
Invoke a Jenkins job from VMware Orchestrator
var jenkinsPollingIntervalMS = 1000;
var buildURL = "";
var buildResult = null;
/*
Create the request object. The two paramaters are:-
- An array of values for the URL template paramaters. We have none, so this is null
- Any content for POST or PUT operations. Ours is a GET, so this is also nulll
*/
var objRESTRequest = generateCatFact.createRequest(null,null);
@BenNeise
BenNeise / New-IaaSHostNamePrefix.ps1
Created December 2, 2015 14:56
Creates a new vRO naming prefix using the IaaS oData interface via REST
Function New-IaaSHostNamePrefix {
<#
.SYNOPSIS
Creates a new vRO naming prefix using the IaaS oData interface via REST
.DESCRIPTION
Creates a new vRO naming prefix using the IaaS oData interface via REST. Tested on vCO 6.2.1 with PowerShell 4
.PARAMETER Server
The name of the IaaS server on which the operation shouldbe performed.
@BenNeise
BenNeise / Restart-VirginRouter.ps1
Last active August 22, 2018 22:30
Restarts a Virgin Media Suberhub using the web interface.
function Restart-VirginRouter {
<#
.Synopsis
Restarts a Virgin Media Suberhub.
.Description
Restarts a Virgin Media Suberhub using the web interface.
.Parameter RouterIP
The IP address of the router.
@BenNeise
BenNeise / ConvertTo-Markdown.ps1
Last active January 12, 2021 18:26
ConvertTo-Markdown
<#
.Synopsis
Converts a PowerShell object to a Markdown table.
.EXAMPLE
$data | ConvertTo-Markdown
.EXAMPLE
ConvertTo-Markdown($data)
#>
Function ConvertTo-Markdown {
[CmdletBinding()]
@BenNeise
BenNeise / Test-Ping documentation
Last active August 29, 2015 14:07
Test-Ping sample documentation
# Test-Ping
## Synposis
Pings a server and returns TRUE or FALSE.
## Syntax
```PowerShell
\Test-Ping.ps1 [-computer] <String> [<CommonParameters>]
```
## Description
@BenNeise
BenNeise / Sort-Json.ps1
Last active August 29, 2015 14:07
Takes a (potentially un-formatted) JSON file, sorts on a specified property, then outputs to a sorted list.
function Sort-JSON {
param (
[Parameter(
Mandatory = $true,
Position = 1
)]
[ValidateScript({
Test-Path $_
})]
[string]
Function GenerateScriptDocumentationInMarkdown {
<#
.Synopsis
Generates documentation for a folder-full of scripts using the integrated Get-Help CMDlets.
.Description
Generates a .markdown documentat for each PS1 script in a folder which has the necessary headers required by Get-Help. Also generates an index document which lists (and links to) all generated documentats. Each file name is preceeded with "script_ps1_" so that they are listed together when viewing the Wiki documents.
.Parameter SourceScriptFolder
Source folder where the scripts are located
@BenNeise
BenNeise / VMWareHorizonViewCapacity.ps1
Created May 9, 2014 08:01
Get VDI Capacity Information from the Horizon View ADAM Database
Connect-QADService -Service "YourConnectionServer"
$ObjVDICapacityData = Get-QADObject -IncludeAllProperties -SizeLimit 0 -SearchRoot "OU=Server Groups,DC=vdi,DC=vmware,DC=int" -Type "pae-ServerPool" | Select-Object Name,@{Name="DisplayName";Expression={$_."pae-DisplayName"}},@{Name="MinProvisioned";Expression={$_."pae-SVIRollingRefitMinReadyVM"}},@{Name="Spare";Expression={$_."pae-VmHeadroomCount"}},@{Name="MaxDesktops";Expression={$_."pae-VmMaximumCount"}},@{Name="MinDesktops";Expression={$_."pae-VmMinimumCount"}}
Disconnect-QADService
$ObjVDICapacityData | Format-Table -Auto