Skip to content

Instantly share code, notes, and snippets.

View CyMadigan's full-sized avatar
🏡
Working from 127.0.0.1

Cyril Madigan CyMadigan

🏡
Working from 127.0.0.1
View GitHub Profile
@CyMadigan
CyMadigan / VMware65RestAPI.ps1
Created August 12, 2021 06:49 — forked from brianbunke/VMware65RestAPI.ps1
Learning the vSphere 6.5 REST API
# vSphere 6.5 VCSA - REST API testing
$vCenterName = 'YOURNAMEHERE'
$BaseURI = "https://$vCenterName/rest"
# At first, I could only make this work with vSphere SSO credentials
# Try that if AD auth is throwing 401 Unauthorized errors at you
# (Discovered later that it didn't like the colon in my AD user's password)
# Can also try "https://YOURVCENTER/apiexplorer" in your browser to test login creds
$c = Get-Credential -UserName 'administrator@vsphere.local' -Message 'Enter password'
@CyMadigan
CyMadigan / basic-dev.ps1
Created April 2, 2021 19:16 — forked from flcdrg/1-boxstarter-bare-v4.ps1
My BoxStarter Scripts
# SQL Server - do this early to avoid issues with newer versions of VC++ 2015 redist
choco install sql-server-2017
choco install sql-server-2017-cumulative-update
choco install sql-server-management-studio
# tools
choco install git
choco install nodejs
choco install tortoisegit
choco install vscode
@CyMadigan
CyMadigan / Start-FileSystemWatcher.ps1
Created September 13, 2020 09:01 — forked from mobzystems/Start-FileSystemWatcher.ps1
Using a FileSystemWatcher from PowerShell
# Start-FileSystemWatcher.ps1 - File System Watcher in Powershell.
# Brought to you by MOBZystems, Home of Tools
# https://www.mobzystems.com/code/using-a-filesystemwatcher-from-powershell/
[CmdletBinding()]
Param(
# The path to monitor
[Parameter(Mandatory=$true, Position=0)]
[string]$Path,
# Monitor these files (a wildcard)
@CyMadigan
CyMadigan / Update-SysinternalsWorkflow.ps1
Created September 11, 2020 21:39 — forked from jdhitsolutions/Update-SysinternalsWorkflow.ps1
A demonstration of using a PowerShell workflow as a scripting tool to download the Sysinternals suite of tools.
#requires -version 4.0
#https://gist.github.com/jdhitsolutions/f0415db6bc8dc6236fb3
<#
A PowerShell workflow to download Sysinternals tools from web to a local folder.
Last updated: February 15, 2016
version : 2.1
@CyMadigan
CyMadigan / gitlab-api.ps1
Created August 29, 2020 12:26 — forked from nobusugi246/gitlab-api.ps1
GitLab API with PowerShell.
# https://docs.gitlab.com/ee/api/projects.html
# https://docs.gitlab.com/ee/api/issues.html
# https://docs.gitlab.com/ee/api/notes.html
# Project List
$r = Invoke-RestMethod -Headers @{ 'PRIVATE-TOKEN'='xxxxx' } -Uri http://xxxxx/api/v4/projects/
$r | Sort-Object -Property id | Format-Table -Property id, name
# Issues List
$r = Invoke-RestMethod -Headers @{ 'PRIVATE-TOKEN'='xxxxx' } -Uri http://xxxxx/api/v4/projects/<xx>/issues
@CyMadigan
CyMadigan / Windows 10 post install script
Created August 29, 2020 12:25 — forked from paulmallon/Windows 10 post install script
Post windows 10 install script to fix UI stuff and privacy settings.
Windows 10 post install script
Please see post_install_part1.ps1 and post_install_part2.ps1 for details
Part 1 - Fix Privacy, Explorer, Logon and misc windows settings
----------------------------------------------------------------------------------------------------------
Disable-UAC
Disable-UpdateRestart
Disable-Autoplay
@CyMadigan
CyMadigan / Get-GitlabProjects.ps1
Created August 29, 2020 12:22 — forked from paulmallon/Get-GitlabProjects.ps1
Powershell script for Gitlab REST API - A quick solution to clone selected (by id or name) or all repositories from the projects returned by API and setup git to track all remote branches. References: Gitlab Projects API: https://docs.gitlab.com/ee/api/projects.html Git doc: https://docs.gitlab.com/ee/api/projects.html
#
# Gitlab clone script
#
# Author: PM
# Date: 2019-10-18#
#
[CmdletBinding(DefaultParameterSetName = 'all')]
param (
[Alias('ID')]
[Parameter(ParameterSetName="id")]
@CyMadigan
CyMadigan / AsOfWiqlQueryToFixIterationPath.ps1
Created July 28, 2020 22:08 — forked from pietergheysens/AsOfWiqlQueryToFixIterationPath.ps1
Fix Iteration Path of work items based on values of the as of parameter in a Azure DevOps WIQL query
$token = ""
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "azdo",$token)))
$uri = "https://dev.azure.com/{organisation}/{teamproject}/_apis/wit/wiql?api-version=5.1"
$body = @"
{
"query": "Select [System.Id], [System.Title], [System.State] From WorkItems
Where [System.TeamProject] = {teamproject} AND [System.WorkItemType] <> 'Test Case'
asof '2020-01-08T10:00:00.000Z'"}
@CyMadigan
CyMadigan / Import-Script.psm1
Created May 30, 2020 22:27 — forked from nohwnd/Import-Script.psm1
Importing self-contained scripts. Demo for PSPowerHour.
function Import-Script {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[String] $Path,
[Hashtable] $Parameters = @{},
[Object[]] $Arguments = @(),
[String] $EntryPoint = 'Main'
)
@CyMadigan
CyMadigan / add-beforeall.ps1
Created May 18, 2020 07:53 — forked from nohwnd/add-beforeall.ps1
Migrate from Pester v4 to v5
# Adds BeforeAll at the top of Tests file to make it follow Pester v5 recommendation of putting
# all code into Pester controlled blocks.
# DO this:
# BeforeAll {
# . $PSScriptRoot/Code.ps1
# }
# DO this:
# BeforeAll {