Skip to content

Instantly share code, notes, and snippets.

View devblackops's full-sized avatar
🎯
Lookin' for code in all the wrong places

Brandon Olin devblackops

🎯
Lookin' for code in all the wrong places
View GitHub Profile
@devblackops
devblackops / vm_move.ps1
Created February 15, 2016 18:42
PowerShell function to perform either local or Cross vCenter vMotion of a VM. Executes extra validation including pings, tracert, and Pester tests pre and post migration.
#Requires -RunAsAdministrator
#Requires -module VMware.VimAutomation.Core, VMware.VimAutomation.Vds, Pester, DrsRule
[cmdletbinding(SupportsShouldProcess)]
param(
[parameter(Mandatory, ValueFromPipelineByPropertyName = $true)]
[Alias('Name')]
[string]$VMName,
[parameter(Mandatory, ValueFromPipelineByPropertyName = $true)]
@devblackops
devblackops / chefquery.ps1
Created January 7, 2016 00:25
PowerShell script to query Chef nodes via REST API. Assumes you have the BouncyCastle.Crypto.dll in the same folder as the script.
function Get-Base64 {
param (
$data
)
# if the $data is a string then ensure it is a byte array
if ($data.GetType().Name -eq "String") {
$data = [System.Text.Encoding]::UTF8.GetBytes($data)
}
Verifying that +devblackops is my blockchain ID. https://onename.com/devblackops
@devblackops
devblackops / Invoke-DscResource_Test.ps1
Last active December 17, 2015 07:19
How can I make Import-DscResource dynamic? I won't know ahead of time what DSC resources will be needed as all the required parameters and the type of resource is passed in by the user.
# Example data to feed into script.
# In real life, this is an array of hashes
# with the required parameters for 1 or more
# custom DSC resources to provision infrastructure
# The types of resources to create will only be
# known at runtime
$ResourceData = @(
@{
Name = 'fileShareTest'
@devblackops
devblackops / DSCBootstrap
Last active August 29, 2015 14:24
Configure DSC client with given GUID
param(
[guid]$guid
)
$computerName = $env:COMPUTERNAME
[DSCLocalConfigurationManager()]
Configuration LCMPull {
param(
[string]$computer,
[guid]$guid,
@devblackops
devblackops / gist:56b55fbc82b96700633b
Last active August 29, 2015 14:24
Modify VMware OS customization spec
PowerCLI C:\> $spec = get-oscustomizationspec win2k12_dsc
PowerCLI C:\> $spec | fl guirunonce
GuiRunOnce : {c:\windows\system32\windowspowershell\v1.0\powershell.exe c:\temp\dscbootstrap.ps1}
PowerCLI C:\> $specClone = new-oscustomizationspec -OSCustomizationSpec $spec -Type NonPersistent
PowerCLI C:\> $specClone | fl guirunonce
GuiRunOnce : {c:\windows\system32\windowspowershell\v1.0\powershell.exe c:\temp\dscbootstrap.ps1}