Skip to content

Instantly share code, notes, and snippets.

View billkindle's full-sized avatar
🏠
Works from home and likes it that way.

Bill Kindle billkindle

🏠
Works from home and likes it that way.
View GitHub Profile
@billkindle
billkindle / MultiHostServices.tests.ps1
Created February 25, 2019 14:29
Sample foreach loop using an array inside a Pester test to check a number of hosts that are running the same service in an application cluster.
# This is an exmaple of Infrastructure testing that can be done with Pester DSL and PowerShell
$nodes = @('node1','node2','node3','node4','node5')
Describe -Name 'Windows Appplication Service Infrastructure' -Tag 'Prod' {
Context -Name 'Application01 Service Checks' {
foreach ($node in $nodes) {
@billkindle
billkindle / Copy-FolderStructure.ps1
Created May 3, 2018 19:40
Simple way to copy a directory folder structure without copying contents of the folders.
<#
This script will only copy folder structure found in the $Source
path to the $Target path.
#>
# Adjust paths to suite needs
$Source = [path]
$Target = [path]
# This will only copy folders
@billkindle
billkindle / Start-PresentationMode.ps1
Created April 23, 2018 22:08
Start a color blind friendly PowerShell console session.
function Start-PresentationMode {
# change certain colors to be friendlier to those with color blindness
Write-Host -ForegroundColor Yellow "Changing ERROR foreground color from RED >>> BLUE"
$Host.PrivateData.ErrorForegroundColor = "Blue"
Write-Host -ForegroundColor Yellow "Ghanging ERROR backround color >>> WHITE"
$Host.PrivateData.ErrorBackgroundColor = "white"
# Could add more here based on what colors are preferred but this is a start.
@billkindle
billkindle / Get-DaysLeftPwshSummit.ps1
Last active April 17, 2018 03:02
Get-DaysLeftPwshSummit.ps1 function for PowerShell Profile or standalone use.
function Get-DaysLeftPwshSummit {
<#
Created By: Bill Kindle
Twitter: @BillKindle
Description:
This is just a simple function you can add to your PowerShell profile
as a reminder to register for PowerShell+DevOps Summit.
function Get-NetAccountInfo {
#obtain the data and do some minor cleanup
$data = net.exe accounts
$data = $data -replace '^[T].*',''
foreach ($line in $data)
{
#split on double colon character
$line = $line -split '\:\s+'