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
# 2019-03-01 | |
# Whatcom IT Professionals meetup | |
# https://www.meetup.com/Whatcom-IT-Professionals/events/259166239/ | |
# Why and How to Get Started With Automated Documentation | |
function Get-TheComputerThings ([switch]$Again) { | |
[PSCustomObject]@{ | |
Name = 'LTAlpha' | |
OS = 'Windows 10 Enterprise' |
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
# 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' |
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
# Advent Of Code 2017 warm-up challenge | |
# https://twitter.com/_sorceress/status/935256907408867328 | |
# https://pastebin.com/BMd61PUv | |
# @brianbunke, 2017/11/27 | |
# Get raw content | |
$1 = (Invoke-WebRequest https://pastebin.com/raw/wGmzZHeq).Content | |
# Split the instruction set on the comma/space combination | |
$ParsedInput = $1 -split ', ' |
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
# Test file for the Vester module - https://github.com/WahlNetwork/Vester | |
# Called via Invoke-Pester VesterTemplate.Tests.ps1 | |
# Test title, e.g. 'DNS Servers' | |
$Title = 'Power State' | |
# Test description: How New-VesterConfig explains this value to the user | |
$Description = 'Starts or stops VMs' | |
# The config entry stating the desired values |
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
#Requires -Version 3 | |
Import-Module VMware.VimAutomation.Core | |
Connect-VIServer XXXXX | |
$Report = New-Object 'System.Collections.Generic.List[PSCustomObject]' | |
$VM = Get-VM | |
$VM | ForEach-Object { | |
$Obj = [PSCustomObject][ordered]@{ | |
VMName = $_.Name |
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
# Barely working :D | |
# Follows my previous Gist, https://gist.github.com/brianbunke/13e32ae67a9232d2224601e937eebba7 | |
# http://theshellnut.com/exploring-powercli-types/ | |
# http://stackoverflow.com/questions/14141043/resolving-an-ambiguous-reference | |
ipmo VMware.VimAutomation.Core | |
$r = "c:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Modules\VMware.VimAutomation.Sdk\VMware.VimAutomation.Sdk.Types.dll", | |
"c:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Modules\VMware.VimAutomation.Core\VMware.VimAutomation.ViCore.Types.dll", |
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
# This code doesn't work. :) Soliciting feedback | |
# Just started duplicating info from here: | |
# (Get-VM 'ExampleVM') | gm | Where MemberType -eq 'Property' | Select Name,Definition | |
$r = "c:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Modules\VMware.VimAutomation.Sdk\VMware.VimAutomation.Sdk.Types.dll", | |
"c:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Modules\VMware.VimAutomation.Core\VMware.VimAutomation.ViCore.Types.dll" | |
Add-Type -ReferencedAssemblies $r -TypeDefinition " | |
using VMware.VimAutomation.ViCore.Types.V1; |
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
$Splatting = @{ | |
Path = "$env:USERPROFILE\Desktop\Your-Script.ps1" | |
Version = '1.0.0' # http://semver.org ;) | |
# GUID will randomly auto-generate for new scripts | |
# Only specify GUID if you're going to overwrite existing properties on an updated script version | |
Author = 'YourPSGalleryUsername' | |
Description = 'Explain your script to prospective users, preferably in one sentence.' | |
# CompanyName | |
# Copyright | |
Tags = @('super','awesome','radical') |
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
<#PSScriptInfo | |
.VERSION 1.0 | |
.GUID a9323abc-0567-4c4f-ad8e-cdd4cb236e3a | |
.AUTHOR Brian | |
.COMPANYNAME |
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-Diacritic { | |
<# | |
.SYNOPSIS | |
Find filenames with diacritic marks, export the list to CSV, and email the list to your boss. | |
.LINK | |
http://powershell.org/wp/2016/03/05/2016-march-scripting-games-puzzle/ | |
#> | |
[CmdletBinding()] | |
param ( |
NewerOlder