Skip to content

Instantly share code, notes, and snippets.

View lholman's full-sized avatar

Lloyd Holman lholman

View GitHub Profile
@lholman
lholman / installJekyllOnWindows.ps1
Last active August 29, 2015 14:11
installJekyllOnWindows
#Original instructions courtesy of 'Run Jekyll on Windows' http://jekyll-windows.juthilo.com/ and https://gist.github.com/luislavena/f064211759ee0f806c88
#Install Ruby and Ruby.DevKit using BoxStarter and Chocolatey
START http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/lholman/f6f789cfd1dc994fd707/raw/fadb7634f275ee8f6486b60bb36c49326457d081/developerWindowsBoxStarterScript.txt
#Config Ruby and Ruby.DevKit
cd c:\tools\DevKit
ruby dk.rb init
Add-Content .\config.yml "`n- C:/tools/DevKit"
runy dk.rb install
@lholman
lholman / gist:b2e66adecbe397dd7397
Created March 20, 2015 16:18
Get-FolderSize usage
Get-ChildItem -path D:\TeamCity\system\artifacts -Filter "bla*" | Where {$_.PSIsContainer -eq $true} | ForEach-Object {$_.FullName} | Get-FolderSize
#https://gallery.technet.microsoft.com/scriptcenter/Get-FolderSize-b3d317f5
@lholman
lholman / compareServerTimes.ps1
Created April 24, 2015 09:37
compareServerTimes
#Taken from original article here: http://blogs.technet.com/b/heyscriptingguy/archive/2012/11/05/use-powershell-to-easily-compare-the-time-between-two-computers.aspx
#Compare time on two servers using TimeSpan
new-timespan -Start (icm 192.168.1.1 {get-date}) -end (icm 192.168.1.2 {get-date})
#Compare time on two servers using invoke-command
invoke-command -ComputerName192.168.1.1 -ScriptBlock {get-date} | Format-List * ; invoke-command -ComputerName 192.168.1.2 -ScriptBlock {get-date} | Format-List *
@lholman
lholman / getAllFilesByExtensionAndPathName.ps1
Last active September 17, 2015 21:20
getAllFilesByExtensionAndPathName
Get-ChildItem -path "C:\Development" -Filter "*.xslt" -Recurse | Where { $_.FullName -like "*Mainline*Environment*"} | ForEach-Object {Start notepad++ $_.FullName}
@lholman
lholman / gist:5669329
Last active December 17, 2015 20:39
A powershell module to add an IIS website and app pool to a specified server
function Add-IISSite{
<#
.SYNOPSIS
A powershell module to add an IIS website and app pool to a specified server
.DESCRIPTION
A powershell module to add an IIS website and app pool to a specified server
.NOTES
Author: Lloyd Holman
DateCreated: 17/01/2013
@lholman
lholman / gist:5669608
Created May 29, 2013 11:25
A powershell module to remove a specific IIS website and app pool from a specified server
function Remove-IISSite{
<#
.SYNOPSIS
A powershell module to remove a specific IIS website and app pool from a specified server
.DESCRIPTION
A powershell module to remove a specific IIS website and app pool from a specified server
.NOTES
Author: Lloyd Holman
DateCreated: 17/01/2013
@lholman
lholman / Remove-ChildFolders.psm1
Last active December 26, 2015 02:49
A Powershell Module to removes a given parentPath or selective child paths based on a supplied pattern, optionally accepts a PSSession object to support execution on a remote server using PSRemoting.
function Remove-ChildFolders{
<#
.SYNOPSIS
Removes a parentPath or selective child paths based on a supplied pattern.
.DESCRIPTION
Removes a parentPath or selective child paths based on a supplied pattern, optionally accepts a PSSession object to support execution on a remote server using PSRemoting.
.NOTES
Author: Lloyd Holman
@lholman
lholman / New-HyperVVMFromISO.psm1
Created December 11, 2013 09:30
Creates a new Hyper-V VM (within the local machines Hyper-V instance), uses sensible defaults that can be optionally overridden and finally boots from a defined ISO file. Given the -Force parameter this module will tear down any existing VM's and VHD's, prior to adding the new VM with the same name. Credits: Takes inspiration from http://www.dep…
function New-HyperVVMFromISO{
<#
.SYNOPSIS
Creates a new Hyper-V VM (within the local machines Hyper-V instance), uses sensible defaults that can be optionally overridden and finally boots from a defined ISO file.
.DESCRIPTION
Creates a new Hyper-V VM (within the local machines Hyper-V instance), uses sensible defaults that can be optionally overridden and finally boots from a defined ISO file.
Given the -Force parameter this module will tear down any existing VM's and VHD's, prior to adding the new VM with the same name.
Credits: Takes inspiration from http://www.deploymentresearch.com/Research/tabid/62/EntryId/129/Script-to-build-a-VM-in-Hyper-V-and-boot-from-an-ISO.aspx and adds some more convention and error handling.
.NOTES
@lholman
lholman / Get-Url.psm1
Created January 15, 2014 13:31
Performs an HTTP GET for a supplied URL, optionally using a supplied hostname and also optionally returning the HTTP statuscode as opposed to response content
function Get-Url{
<#
.SYNOPSIS
Performs an HTTP GET for a supplied URL
.DESCRIPTION
Performs an HTTP GET for a supplied URL, optionally using a supplied hostname and also optionally returning the HTTP statuscode as opposed to response content
.NOTES
Requirements: Copy this module to any location found in $env:PSModulePath
@lholman
lholman / gist:4121d852581557a863bb
Last active April 8, 2016 15:09
Handy DSC scripts
$dscProcessID = Get-WmiObject msft_providers | Where-Object {$_.provider -like 'dsccore'} | Select-Object -ExpandProperty HostProcessIdentifier
Get-Process -Id $dscProcessID | Stop-Process
Get-WmiObject msft_providers | Select-Object -Property Provider, HostProcessIdentifier
#Often we see that the Provider 'WMIEventProv' is left locking files too