This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# Standard base includes and define this as a metaclass of type | |
from __future__ import (absolute_import, division, print_function) | |
__metaclass__ = type | |
# Important contants | |
from ansible import constants as C | |
# Common error handlers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2021 - George Bowen | |
# Usage: | |
# Add this to your vscode powershell profile "code $profile", | |
# then, select any text in your editor, type alt+shift+s, select Convert Code Block to Snippet, | |
# which will return a json code block for you to add to your vscode snippets file | |
function ConvertTo-JsonCodeBlock { | |
<# | |
.SYNOPSIS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Installs a given terraform plugin/provider from github | |
.EXAMPLE | |
PS C:\> ./Install-TerraformPlugin -GitHubPath Mastercard/terraform-provider-restapi | |
Install-TerraformPlugin will search github the repo: Mastercard/terraform-provider-restapi | |
foo and check if the latest version has been added to the local terraform | |
plugins dir. If not, it will downlaod and install it. | |
.NOTES | |
- Only supports Windows at the moment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ConvertTo-ArrayList ( [PSCustomObject]$CustomObject ) { | |
$ObjectProperties = $CustomObject.PSObject.Properties | |
$IntermediateHashtable = @{} | |
foreach ( $Property in $ObjectProperties ) { | |
$IntermediateHashtable."$($Property.Name)" = $Property.Value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ConvertTo-BasicAuth { | |
[cmdletbinding()] | |
param ( | |
[Parameter( ValueFromPipeline )] | |
[PSCredential] | |
$Credential | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Write-LogMessage { | |
<# | |
.SYNOPSIS | |
Console logging helper function. | |
.DESCRIPTION | |
For a given set of parameters, will create a standardized log message that can be written to any of | |
the various output streams. | |
For more documentation on the available output streams see this: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function New-ReusableCommandArgs { | |
<# | |
.SYNOPSIS | |
Creates a hashtable from the pararmters supplied to the function that has called this function | |
.DESCRIPTION | |
Determines which values are actually being used and returns them as a hash table | |
which can be easily platted to other commands | |
https://www.briantist.com/how-to/splatting-psboundparameters-default-values-optional-parameters/ | |
#> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Inputs text into vmware console | |
- VMware console MUST be running at same level as script. e.g elevated or not elevated | |
- Intiate the hotkey from outside of vmware. | |
- This is useful for pasting long passwords or scripts | |
- Usage: | |
1. Open vmware console | |
2. Copy some content from your local machine to your clipboard | |
3. Run the autohotkey script ( elevated if vmware console is running elevated ). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-PatchDownloadURLs { | |
<# | |
.SYNOPSIS | |
Returns all download links for a given patch | |
.DESCRIPTION | |
A PATCH is not just a KB article ID, at least not in this sense. A patch | |
is a GUID that represents a KB applied to a **specific** computer. | |
.NOTES | |
Why am I doing it like this? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Invoke-StringMatch { | |
<# | |
.SYNOPSIS | |
Parses a list of strings and return the string most closely matching the provided string | |
.DESCRIPTION | |
Function will take a providded search string, remove special characters and create an array | |
out of all the words in the string. | |
Then, it will loop through this array and check to see if a given word is found in any of |