Skip to content

Instantly share code, notes, and snippets.

View bjeans's full-sized avatar

Barnaby Jeans bjeans

View GitHub Profile

Keybase proof

I hereby claim:

  • I am bjeans on github.
  • I am bjeans (https://keybase.io/bjeans) on keybase.
  • I have a public key ASDhV0pDW88hOrJG6ZRQ0_3olSch9Tmm5c1e7n17nUgtNgo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am bjeans on github.
  • I am bjeans (https://keybase.io/bjeans) on keybase.
  • I have a public key ASAfuSl3lGZRRc3MiOqJz8mYUKPIDuili7fe-JdeloCtgQo

To claim this, I am signing this object:

@bjeans
bjeans / CleanupRG.ps1
Last active June 14, 2016 03:59
Find and remove empty (ARM) resource groups
$SUBs = Get-AzureRmSubscription
foreach ($SUB in $SUBs)
{
Select-AzureRmSubscription -SubscriptionName $SUB.SubscriptionName
$RGs = Get-AzureRMResourceGroup
foreach($RG in $RGs)
{
@bjeans
bjeans / dmxControl.c
Last active August 29, 2015 14:26
Arduino Sketch to control DMX with push buttons
/*
**
** After uploading to Arduino, switch to Serial Monitor and set the baud rate
** to 9600.
**
**
** DmxMaster library help & support: http://groups.google.com/group/DmxMaster */
#include <DmxMaster.h>
@bjeans
bjeans / RDP-to-AzureVM.ps1
Last active August 29, 2015 14:17
Get Host and Port for AzureVM and then launch mstsc to RDP in
$vm = Get-AzureVM –ServiceName "example-1-svc" –Name "example-1"
$rdp = Get-AzureEndpoint -Name "Remote Desktop" -VM $vm
$hostdns = (New-Object "System.Uri" $vm.DNSName).Authority
$port = $rdp.Port
Start-Process "mstsc" -ArgumentList "/V:$hostdns`:$port /w:1024 /h:768"
@bjeans
bjeans / StorageSpaces.ps1
Created February 25, 2015 03:59
Create striped storage space and disk
$PhysicalDisks = Get-StorageSubSystem -FriendlyName "Storage Spaces*" | Get-PhysicalDisk -CanPool $True
$sPool = New-StoragePool -FriendlyName "CompanyData" -StorageSubsystemFriendlyName "Storage Spaces*" -PhysicalDisks $PhysicalDisks -ResiliencySettingNameDefault Simple
$vDisk = New-VirtualDisk -FriendlyName "UserData" -UseMaximumSize -NumberOfColumns $PhysicalDisks.Count -StoragePoolFriendlyName $sPool.FriendlyName -ResiliencySettingName Simple
$vDisk | Initialize-Disk
Get-Disk |Where-Object {$_.FriendlyName -like "*Storage Space*"}|New-Partition -AssignDriveLetter -UseMaximumSize |Format-Volume
@bjeans
bjeans / migrate-vms.ps1
Created November 17, 2014 02:50
Migrate VMs
$sourceHost = "Hyperv-one"
$destHost = "Hyperv-two"
# Collect list of VMs to move
$groups = Get-ClusterNode $sourceHost | Get-ClusterGroup | ?{ $_ | Get-ClusterResource | ?{ $_.ResourceType -like "Virtual Machine" } }
# Move VMs to new host in failover cluster
foreach ( $group in $groups ) { $group | Move-ClusterVirtualMachineRole -Node $destHost }
@bjeans
bjeans / InstallRoles.ps1
Last active August 29, 2015 14:08
Install Hyper-v, File Server, and Failover Clustering on Server
Add-WindowsFeature -name FS-FileServer -IncludeManagementTools
Add-WindowsFeature -name Failover-Clustering -IncludeManagementTools
Add-WindowsFeature -name Hyper-V -IncludeManagementTools
@bjeans
bjeans / get-VM-network-details.ps1
Created September 15, 2014 16:26
Get Hyper-v VM network details
get-vm | select -ExpandProperty networkadapters | select vmname, macaddress, switchname, ipaddresses