Skip to content

Instantly share code, notes, and snippets.

Avatar
🚁
Puppetizing and PowerShelling all the things.

Bill Hurt RandomNoun7

🚁
Puppetizing and PowerShelling all the things.
View GitHub Profile
@RandomNoun7
RandomNoun7 / github_org_runner_scanner.ps1
Created Jun 17, 2020
Scan Github Org For Internal Runners
View github_org_runner_scanner.ps1
Install-Module PowerShellForGithub
# Enter anything for username, and your token for the password.
# This sets it globally for all future runs.
Set-GitHubAuthentication
$repos = Get-GithubRepository -OrganizationName puppetlabs
foreach ($repo in $repos) {
$runner = Invoke-GHRestMethod -UriFragment "/repos/$($_.full_name)/actions/runners" -Method Get -ErrorAction SilentlyContinue
View sort-testing.ps1
$events = @(
[PSCustomObject]@{type = 'phase'; name = 'Build API'; parentID = '1'; id = '2'}
[PSCustomObject]@{type = 'task'; name = 'Checkout'; parentID = '3'; id = '5'}
[PSCustomObject]@{type = 'task'; name = 'Nuget Tool Installer'; parentID = '3'; id = '6'}
[PSCustomObject]@{type = 'task'; name = 'use .NET Core SDK'; parentID = '3'; id = '7'}
[PSCustomObject]@{type = 'job'; name = 'Build API'; parentID = '2'; id = '3'}
[PSCustomObject]@{type = 'task'; name = 'Initialize Job'; parentID = '3'; id = '4'}
[PSCustomObject]@{type = 'Stage'; name = 'Deploy C1'; parentID = ''; id = '8'}
[PSCustomObject]@{type = 'Phase'; name = 'Deploy API to SIT'; parentID = '8'; id = '9'}
[PSCustomObject]@{type = 'job'; name = 'Deploy API C1'; parentID = '9'; id = '10'}
View restart_service.json
{
"puppet_task_version": 1,
"supports_noop": false,
"description": "Stop or restart a service or list of services on a node.",
"parameters": {
"service": {
"description": "The name of the service, or a list of service names to stop.",
"type": "Variant[Array[String],String]"
},
"norestart": {
@RandomNoun7
RandomNoun7 / evaluation.md
Last active Nov 20, 2018
virtualdesktops-sqlservewalwayson Evaluation
View evaluation.md

Does the module work?

I was not able to get the module to function. It looks like the module should probably work if the underlying dsc resources worked properly. As far as I can tell we have vendered in a version of a dsc resource called dsc_userrightsassignment that has a bug. It is unable to assign rights to local administrator account. When searching for that account to give it rights, it uses a set of functions defined in a file called SecurityPolicyResourceHelpers.psm1. We are currently vendoring version 2.2.0 of that dsc resource module. Latest is 2.5.0, and the diff (You will have to search for DSCResources/SecurityPolicyResourceHelper/SecurityPolicyResourceHelper.psm1 to find the file diff in question.) has a lot of improved code including proper error handling which would most likely solve the error.

The error in question prevents the run from completing.

@RandomNoun7
RandomNoun7 / Pipelines-Rest-Example.ps1
Last active Sep 25, 2018
Pipelines New App Example
View Pipelines-Rest-Example.ps1
$apiToken = $env:ApiToken
$username = $env:Username
$apiUrl = $env:ApiUrl
$appsUri = "https://$apiUrl/$Username/apps?apiToken=$ApiToken"
$appsCollection = Invoke-RestMethod -Uri $appsUri
Write-Output "Existing Apps"
Write-Output $appsCollection.apps.name
@RandomNoun7
RandomNoun7 / should_be_broken.txt
Created Dec 21, 2017
should_not_break ran ok on windows2012. Should_be_broken ran on 2008 and failed to skip properly.
View should_be_broken.txt
Printing Environment
BEAKER_debug=true
BEAKER_destroy=no
BEAKER_keyfile=~/.ssh/id_rsa-acceptance
BEAKER_PE_DIR=http://enterprise.delivery.puppetlabs.net/2017.3/ci-ready
BEAKER_setfile=spec/acceptance/nodesets/default.yml
BUNDLE_BIN=.bundle/bin
BUNDLE_PATH=.bundle//gems
EVENT_NOEPOLL=1
View keybase.md

Keybase proof

I hereby claim:

  • I am randomnoun7 on github.
  • I am bhurt (https://keybase.io/bhurt) on keybase.
  • I have a public key ASA9h9C7D2wRavUVa1WzdWtNP36VZgUs5x0Bz72dN7IQLwo

To claim this, I am signing this object:

@RandomNoun7
RandomNoun7 / Invoke-BHSqlQuery.ps1
Created Mar 30, 2016
Custom Invoke SQL Query Script after I got annoyed with SQLPS from SQL 2008r2
View Invoke-BHSqlQuery.ps1
function Invoke-BHSQLProc
{
param
(
[cmdletBinding()]
[string]$server = $env:COMPUTERNAME,
[parameter(Mandatory = $true)]
[string]$dbname,
[parameter(Mandatory = $true)]
[string]$proc,
View SNMPUtils.ps1
#Requires -Version 4
function Get-SNMPAgent
{
<#
.SYNOPSIS
Reads the SNMP Agent string value from a Windows computers registry.
.DESCRIPTION
Uses the Microsoft.Win32.RegistryKey class to open registry keys on remote computers even if WinRM is not enabled.
Output is a series of PSObject's with two string properties: computer and agent.
You can’t perform that action at this time.