Skip to content

Instantly share code, notes, and snippets.

View AspenForester's full-sized avatar

JB Lewis AspenForester

  • Hennepin County, MN, USA
  • Minnesota, USA
View GitHub Profile
@AspenForester
AspenForester / Enable-WSManRemote
Created June 14, 2018 20:07
Leverages PSexec to execute winrm quickconfig on machines that don't have WSMan enabled for remoting
function Enable-WSManRemote
{
[cmdletbinding()]
Param(
[Parameter(Position = 0,
ValueFromPipeline = $True,
ValueFromPipelineByPropertyName = $True)]
[ValidateNotNullorEmpty()]
[string[]]
@AspenForester
AspenForester / Test-WSManAllServer.ps1
Created June 14, 2018 20:05
Tests for WSMan being enabled on one or more computers, and returns an object containing the computer name and a boolean value.
function Test-AllWSMANServer
{
[CmdletBinding()]
param (
# Computername
[Parameter(ValueFromPipeline = $true)]
[String[]]
$ComputerName
)
function Register-DNSVMGuest
{
#Requires -modules VMware.VimAutomation.Core,DNSClient
[CmdletBinding()]
param (
# Parameter help description
[Parameter(Mandatory = $true)]
[ValidateNotNullorEmpty]
[String]
$VIServer,
@AspenForester
AspenForester / Compare-Things.ps1
Last active June 11, 2018 13:25
Compare one thing to a collection of wildcarded things
function Compare-Things
{
[CmdletBinding()]
[OutputType([bool])]
Param
(
# The singular thing that want to see if it matches
[Parameter(Mandatory=$true,
ValueFromPipelineByPropertyName=$true,
Position=0)]
@AspenForester
AspenForester / Get-PowerShellSummit2018AvailableSeats.ps1
Created January 4, 2018 19:08
Quick and dirty, should return the number of seats available for the 2018 PowerShell + DevOps Global Summit
$Foo = Invoke-WebRequest -Uri 'https://www.eventbrite.com/e/powershell-devops-global-summit-2018-registration-32452427083' -UseBasicParsing
$null = $foo -match 'remaining":(\d{1,3})'
$Matches[1]
@AspenForester
AspenForester / NBU8.cmd
Last active January 4, 2018 14:56
I usually run this remotely with psexec \\target -h -u domain\adminuser -c nbu8.cmd This is an improvement on the silent installer that comes with Netbackup. You need to add your org's info lines 16 and 23, plus create and point to a share on line 62 that at least contains the PC_Clnt\x64 directory from the install media.
@REM $Id: silentclient.cmd,v 1.24 2012/06/04 18:55:53 $
@ECHO -----------------------
@ECHO %COMPUTERNAME%
@DATE /T
@TIME /T
@ECHO -----------------------
@ECHO OFF
REM -------------------------------------------------------------------------------------------
SET CLIENT=%COMPUTERNAME%
Class PlayingCard {
[String] $Suit
[String] $FaceValue
hidden [int] $Value
PlayingCard (){}
PlayingCard ([String] $Suit, [String] $FaceValue){
$this.Suit = $Suit
$this.FaceValue = $FaceValue
@AspenForester
AspenForester / Get-SummitSeats.ps1
Created November 1, 2016 21:14
Parses the HTML for the 2017 PowerShell Summit Eventloom page and returns the current number of available seats. It was written very as a think-type-do exercise. Show me you can do better!
$url = "https://eventloom.com/event/home/summit2017"
$page = Invoke-WebRequest -Uri $url
$outertext = $page.ParsedHtml.getElementsByTagName("div") | where Classname -eq "col-md-6" | Select -ExpandProperty OuterText
$AvailableText = ($outertext -split '[\r\n]').Where({$_ -like "*avail*"})
$SeatsAvailable = $AvailableText.Split(' ')[0]
@AspenForester
AspenForester / event1.ps1
Created May 16, 2014 17:39
2013 PowerShell Scripting Games
{$_.Creationtime -lt (Get-Date).AddDays(-90)} |
ForEach-Object {
Move-Item -Force -Recurse -Path $_.FullName -Destination $($_.FullName.Replace("C:\Application\Log","\\NASServer\Archives"))
}
@AspenForester
AspenForester / Clear-ADGroupMember.ps1
Created May 16, 2014 16:36
A couple of quick functions for AD group maintenance
# requires version 3.0
<# Clear-ADGroupMember
.Synopsis
Removes all users from an AD group
.DESCRIPTION
Removes all users from an AD group provided to the script.
.EXAMPLE
“my-group” | Clear-ADGroupMember
#>