Skip to content

Instantly share code, notes, and snippets.

View MattHodge's full-sized avatar

Matthew Hodgkins MattHodge

View GitHub Profile
if ($env:install_vbox_tools -eq $true)
{
Write-Host "Installing Virtualbox Guest Additions"
certutil -addstore -f "TrustedPublisher" E:\cert\oracle-vbox.cer
Start-Process -FilePath "E:\VBoxWindowsAdditions.exe" -ArgumentList "/S" -Wait
}
else
{
Write-Host "Skipping installation of Virtualbox Guest Additions"
}
# Install the Oracle certificate first
certutil -addstore -f "TrustedPublisher" E:\cert\oracle-vbox.cer
Start-Process -FilePath "E:\VBoxWindowsAdditions.exe" -ArgumentList "/S" -Wait
$sourcePath = 'C:\packer\output-window2012r2-basewin2012r2-base.ovf'
Start-Process -FilePath 'packer.exe' -ArgumentList "build -var `"source_path=$($sourcePath)`" .\02-win_updates-wmf5.json" -Wait -NoNewWindow
@MattHodge
MattHodge / Start-ProcessWithCapture.ps1
Created May 26, 2016 20:10
Start-ProcessWithCapture.ps1
<#
.Synopsis
Allows running processes and capturing output.
.DESCRIPTION
Allows running processes and capturing output.
.EXAMPLE
Start-ProcessWithCapture -FilePath 'git' -ArgumentList 'pull' -WorkingDirectory $Path -ErrorAction Stop
#>
function Start-ProcessWithCapture
{
@MattHodge
MattHodge / ReplaceStorageSpacesFailedDisk.ps1
Created February 5, 2016 13:03
ReplaceStorageSpacesFailedDisk.ps1
# Find the failed Disk
Get-PhysicalDisk
# Shutdown, take the disk out and reboot. Set the missing disk to a variable
$missingDisk = Get-PhysicalDisk | Where-Object { $_.OperationalStatus -eq 'Lost Communication' }
# Retire the missing disk
$missingDisk | Set-PhysicalDisk -Usage Retired
# Find the name of your new disk
<#
.Synopsis
Short description
.DESCRIPTION
Long description
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
#>
@MattHodge
MattHodge / SetEnvVar.ps1
Created January 25, 2016 02:37
SetEnvVar.ps1
# This will need to be done with an Administrative PowerShell Prompt
[Environment]::SetEnvironmentVariable("NODE_TLS_REJECT_UNAUTHORIZED", "0", "Machine")
@MattHodge
MattHodge / get-servicehubot.coffee
Last active January 24, 2016 20:07
get-servicehubot.coffee
# Description:
# Gets the status of a service on the Hubot server
#
# Commands:
# hubot get service <service name> - Finds the status of a service on the Hubot server
# Require the edge module we installed
edge = require("edge")
# Build the PowerShell that will execute
@MattHodge
MattHodge / Get-ServiceHubot.ps1
Last active January 24, 2016 20:04
Get-ServiceHubot.ps1
<#
.Synopsis
Gets service status for Hubot Script.
.DESCRIPTION
Gets service status for Hubot Script.
.EXAMPLE
Get-ServiceHubot -Name dhcp
#>
function Get-ServiceHubot
{
@MattHodge
MattHodge / Add Path Environment Variable.ps1
Created November 8, 2015 04:53
Add Path Environment Variable
# Requires the Add-PathVariable function from my PowerShell Profile
Add-PathVariable -Path 'C:/opscode/chefdk/embedded/bin'