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 / 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}
devblackops / DSCBootstrap
Last active August 29, 2015 14:24
Configure DSC client with given GUID
$computerName = $env:COMPUTERNAME
Configuration LCMPull {
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'
Verifying that +devblackops is my blockchain ID.
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
[parameter(Mandatory, ValueFromPipelineByPropertyName = $true)]
[parameter(Mandatory, ValueFromPipelineByPropertyName = $true)]

OVF Thoughts

Here are few thoughts on potential improvements to the Operation Validation Framework module for executing Pester tests.

These ideas are meant to improve the flexibility of the Operation Validation Framework by adding the capability to override parameters used in Pester tests with user provided values. This would allow generic OVF modules that test core Infrastructure technologies to be published to public repositories like the PowerShell Gallery while allowing the user to tailor the tests to their environment.

Pester script defaults

devblackops / Custom-Attribute.ps1
Last active January 23, 2017 17:12
Custom attributes attached to PowerShell function
Add-Type -TypeDefinition @"
namespace PoshBot {
public class BotCommand : System.Attribute {
public string Description { get; set; }
function Foo {
[PoshBot.BotCommand(Description = 'This is a custom function description')]
devblackops / Shorten-Url.ps1
Created September 7, 2017 03:51
PoshBot function to shorten a url
function Url {
Command = $false,
TriggerType = 'Regex',
Regex = '^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)|[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}[^ ]+'
[parameter(Mandatory, ValueFromRemainingArguments)]

Keybase proof

I hereby claim:

  • I am devblackops on github.
  • I am devblackops ( on keybase.
  • I have a public key ASDd4DO8BeRC7l3kECkdj8Z6NHEdIeP0dNK50DRr1sBWUwo

To claim this, I am signing this object:

devblackops / Get-MonitorDetail.ps1
Last active January 15, 2018 04:57
Iron Scripter Prequel 1
function Get-MonitorDetail {
[parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[string[]]$ComputerName = $env:COMPUTERNAME,