Skip to content

Instantly share code, notes, and snippets.

View chelnak's full-sized avatar
👀
What's cooking?

Craig Gumbley chelnak

👀
What's cooking?
View GitHub Profile
@chelnak
chelnak / updateXaaSWorkflowAssociation.js
Last active November 23, 2016 20:20
Update the vRO Workflow Associated with an XaaS Blueprint
/*
- Update the vRO Workflow Associated with an XaaS Blueprint
- Input: vCACCAFEHost [vCACCAFE:vCACHost]
- Input: blueprintId [String]
- Input: workflowId [String]
*/
var tenant = vCACCAFEHost.tenant;
@chelnak
chelnak / resetUserPrincipalPassword.js
Created October 4, 2016 12:56
Reset the password of a vRA local user principal with vRO
/*
- Reset the password of a local user principal
- Input: vCACCAFEHost [vCACCAFE:vCACHost]
- Input: principalId [String]
- Input: password [SecureString]
- Input: confirmPassword [SecureString]
- Output: [Void]
*/
@chelnak
chelnak / getUserPrincipalEmailAddress.js
Created October 4, 2016 10:49
Retrieve the Email Address of a user principal in vRA with vRO
/*
- Retrieve the email address of a user principal
- Input: vCACCAFEHost [vCACCAFE:vCACHost]
- Input: principalId [String]
- Output: emailAddress [String]
*/
var tenant = vCACCAFEHost.tenant;
@chelnak
chelnak / Export-Blueprints.ps1
Created September 21, 2016 14:48
Export vRA blueprints as content packages with PowervRA
#requires -version 5
<#
- Export vRA Blueprint content package and extract the archive
- Requires PowerShell 5
#>
# --- Set Filter
@chelnak
chelnak / escapeURIString.ps1
Created September 16, 2016 14:51
Escape URI String with PowerShell
$URI = "/catalog-service/api/consumer/resourceViews/?withExtendedData=$($WithExtendedData)&withOperations=$($WithOperations)&managedOnly=$($ManagedOnly)&`$orderby=name asc&limit=$($Limit)&page=$($page)&`$filter=resourceType/id eq 'Infrastructure.Machine' or resourceType/id eq 'Infrastructure.Virtual' or resourceType/id eq 'Infrastructure.Cloud' or resourceType/id eq 'Infrastructure.Physical'"
$EscapedURI = [uri]::EscapeUriString($URI)
$Response = Invoke-vRARestMethod -Method GET -URI $EscapedURI -Verbose:$VerbosePreference
@chelnak
chelnak / createTenant.ps1
Created August 5, 2016 08:57
Create a vRA tenant with a local user and add a directory
# --- Create the tenant
New-vRATenant -Name Tenant01 -Description "This is tenant 01" -URLName tenant01 -ContactEmail tenantadmin@company.com -ID tenant01
# --- Create a local user
New-vRAUserPrincipal -PrincipalId tenantadmin@vsphere.local -Tenant Tenant01 -FirstName tenant -LastName admin -EmailAddress tenantadmin@company.com -Description "Tenant admin local user" -Password password123
# --- Add local user as a tenant and iaas admin
Add-vRAPrincipalToTenantRole -TenantId Tenant01 -PrincipalId tenantadmin@vsphere.local -RoleId CSP_TENANT_ADMIN
Add-vRAPrincipalToTenantRole -TenantId Tenant01 -PrincipalId tenantadmin@vsphere.local -RoleId COM_VMWARE_IAAS_IAAS_ADMINISTRATOR
function Get-VMExtendedInfo {
<#
.SYNOPSIS
Gets extended information about a Virtual Machine
.DESCRIPTION
Gets extended information about a Virtual Machine
.PARAMETER VM
The Virtual Machine to query
@chelnak
chelnak / GetNSXSecurityTagByName.js
Created July 27, 2016 19:45
Get an NSX Security Tag by name
/*
- Get an NSX Security Tag by name
Inputs:
NSXEndpoint [NSXConnection]
securityGroupName [String]
*/
@chelnak
chelnak / RenameCustomObjectType.ps1
Last active July 26, 2016 19:26
Rename a custom object and add a default output for the new type
$Object = [PSCustomObject]@{
Id = "1"
Name = "VM01"
Description = "A virtual machine"
Location = "UK"
IPAddress = "10.0.0.1"
}
@chelnak
chelnak / ListEntitlementsAndPrincipals.ps1
Created July 25, 2016 14:49
List all entitlements and associated principals with PowervRA
Get-vRAEntitlement | Select Name, @{Name="Principals"; Expression={$_.Principals.ref}}