Skip to content

Instantly share code, notes, and snippets.

View bundyfx's full-sized avatar

Flynn Bundy bundyfx

View GitHub Profile
@bundyfx
bundyfx / gist:5b8ac3a16d807b40cda4
Created July 5, 2015 03:59
Puzzle #1 Scripting Games
GWMI WIN32_OPERATINGSYSTEM -CN DC1,DSC1 | SELECT P*ME,S*J*N,V*,@{N=’BIOSSERIAL';E={GWMI -CN $_.PSCOMPUTERNAME WIN32_BIOS| SELECT -EXPAND S*R}}
@bundyfx
bundyfx / gist:22aae897c286895de39a
Last active August 29, 2015 14:25
rename machine to IP address
$ip=((gwmi Win32_NetworkAdapterConfiguration | ? { $_.IPAddress -ne $null }).ipaddress | select -First 1)
$ipAddressName = $ip.Replace(".","-")
If ($env:COMPUTERNAME -eq $ipAddressName) {
Write-Host "$ipAddressName No need to change"
}
Else {
Rename-Computer -NewName $ipAddressName -Restart
}
$csv = Import-csv C:\Input.csv
$csv.MachineName | ForEach-Object {if(Test-Connection -Count 1 -Quiet $_){ $_ | Select @{N='MACHINENAME';E={Get-WmiObject -cn $_ Win32_OperatingSystem | Select -expand PsC*}},@{N='OSVERSION';E={Get-WmiObject -cn $_ Win32_OperatingSystem | Select -ExpandProperty Cap*}}}} | Export-Csv C:\Output.csv -nti
@bundyfx
bundyfx / NBA_RSS_October_2015
Created October 11, 2015 10:03
October 2015 Scripting Games (NBA RSS)
#Requires -Version 3.0
<#
.Synopsis
Get the latest updates on your favourite NBA teams!
.EXAMPLE
Get-RSSFeed -Team Lakers
.EXAMPLE
Get-RSSFeed Spurs
.NOTES
Why not combine two of my favourite things! PowerShell/NBA
param([string]$VMNameStr)
0..(($VMNameStr -split ",").GetLength(0) -1) | % {Set-Variable "VMName$Psitem" -Value ($VMNameStr -split ',')[$Psitem] -PassThru }
#The VMNameStr param is intended to be taken as a single string rather than the conventional array of strings ([String[]]).
#Take values from param, split those and turn it in a range, Foreach of those create a new variable based on the number coming across the pipeline.
#The value of those variables will be the original array split calling the position index of the current item in the pipeline (Passthru to display this on the screen).
@bundyfx
bundyfx / DecemberScriptingGames.ps1
Created December 9, 2015 00:58
December Scripting Games Puzzle !!
$list = @"
1 Partridge in a pear tree
2 Turtle Doves
3 French Hens
4 Calling Birds
5 Golden Rings
6 Geese a laying
7 Swans a swimming
8 Maids a milking
9 Ladies dancing
@bundyfx
bundyfx / Jan2016-ScriptingGames
Last active January 3, 2016 10:05
Jan 2016 Scripting Games
<#
.Synopsis
Get the Up time (Last boot time) of target machines.
.EXAMPLE
Get-Uptime -Computername DC1,NLB1,NLB2
.EXAMPLE
$Collection | Gup
.EXAMPLE
$Collection | Get-Uptime | Export-CSV C:\Temp\UpTime.csv -nti
.EXAMPLE
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication3"
Title="DSC Control Center" Height="491.015" Width="1102.416" ResizeMode="NoResize">
<Grid>
<TextBox Name="Computer" HorizontalAlignment="Left" Height="23" Margin="81,9,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="170"/>
<Label Name="label" Content="Computer:" HorizontalAlignment="Left" Margin="10,6,0,0" VerticalAlignment="Top" Width="66"/>
#Starting Section
$reader=(New-Object System.Xml.XmlNodeReader $xaml)
$Window=[Windows.Markup.XamlReader]::Load($reader)
break
#0o0o0o0o0 git content
$ContentPaths = 'C:\Lab\Git\Prod','C:\Lab\Git\Test','C:\Lab\Git\Dev'
git clone https://github.com/bundyfx/Example-Web.git $ContentPaths[0] --quiet
git clone https://github.com/bundyfx/Web-Example-Test.git $ContentPaths[1] --quiet
git clone https://github.com/bundyfx/Web-Example-Dev.git $ContentPaths[2] --quiet
ii C:\Lab\Git