Skip to content

Instantly share code, notes, and snippets.

[CmdletBinding()]
param(
[Parameter(Mandatory)]
[string]$VMName,
[Parameter(Mandatory)]
[string]$OutputFile
)
function Get-DriveType($drive)
@ducke
ducke / gist:d93a9496f9337df7e65c
Last active September 2, 2015 21:01 — forked from ncerny/gist:8d4aa3696e460668518f
Windows Development Kit for Chef
launch powershell with admin privileges
run:
Install-Package -name git -provider chocolatey
Install-Package -name chefdk -minimumVersion 0.6.0.1 -provider chocolatey
Install-Package -name atom -provider chocolatey
Open powershell window as user
apm install linter
@ducke
ducke / PesterVersionCheck.ps1
Last active September 4, 2015 16:06 — forked from dlwyatt/PesterVersionCheck.ps1
TeamCity Example Code
try
{
$path = '%system.teamcity.build.checkoutDir%'
Set-Location $path
$psd1 = Join-Path $path Pester.psd1
Import-Module $psd1 -ErrorAction Stop
$xml = Join-Path $path Test.Version.xml
@ducke
ducke / gist:da42524d5eeb546abf94
Last active September 14, 2015 07:06 — forked from stevenkuhn/gist:5062660
This PowerShell script generates release notes for Octopus Deploy that contain the GitHub commits and JIRA issues from the current build to the latest production release. It will also create the Octopus release based on the TeamCity build number.
#
# Assumptions
#
# 1. If you have a Octopus release deployed, say 1.0.0.73, there is a git
# tag set for that commit in GitHub that is "v1.0.0.73".
#
# 2. You have TeamCity label each successful build in GitHub with the format
# "v{build number}. Sidenote: it appears that TeamCity only labels the
# default branch, but not feature branches.
#

PowerShell modules, digital signatures, NuGet nuspec and packages

d-fens GmbH General-Guisan-Strasse 6 CH-6300 Zug Switzerland

@ducke
ducke / DeployToOctopus.ps1
Created October 1, 2015 12:20 — forked from mbenford/DeployToOctopus.ps1
Powershell script for TeamCity that creates and deploys a release on Octopus Deploy based on the current branch
function Is-Default-Branch {
return "%teamcity.build.branch.is_default%" -eq "true"
}
function Build-Arguments {
if (Is-Default-Branch) {
$releaseNumber = "%octopus.master.releaseNumber%"
$deployTo = "%octopus.master.deployTo%"
$packageVersion = "%octopus.master.packageVersion%"
}
@ducke
ducke / gist:1c5bd2bb25f9c162da92
Last active October 1, 2015 19:42
Teamcity octo pack
try {
If (-not (choco list -l | Select-String -SimpleMatch 'octopustools' -Quiet)) {
throw 'No Chocolatey magig found. EXIT!'
}
$OctoPath = Join-Path $env:ChocolateyInstall bin
$OctoExe = Join-Path $OctoPath 'octo.exe'
$Args = '--help','pack','--id=','--include=','--basePath=','--outFolder=','--version=','--author=','--title=','--description='
$IP = '192.168.138.10'
$MaskBits = 24 # This means subnet mask = 255.255.255.0
$Gateway = '192.168.138.2'
$Dns = '192.168.138.2'
$IPType = 'IPv4'
# Retrieve the network adapter that you want to configure
$adapter = Get-NetAdapter | Where-Object {$_.Status -eq 'up'}
# Remove any existing IP, gateway from our ipv4 adapter
@ducke
ducke / Set-WindowStyle.ps1
Created October 13, 2015 08:20 — forked from Nora-Ballard/Set-WindowState.ps1
Hide, Show, Minimize, Maximize, etc window from Powershell.
function Set-WindowStyle {
param(
[Parameter()]
[ValidateSet('FORCEMINIMIZE', 'HIDE', 'MAXIMIZE', 'MINIMIZE', 'RESTORE',
'SHOW', 'SHOWDEFAULT', 'SHOWMAXIMIZED', 'SHOWMINIMIZED',
'SHOWMINNOACTIVE', 'SHOWNA', 'SHOWNOACTIVATE', 'SHOWNORMAL')]
$Style = 'SHOW',
[Parameter()]
$MainWindowHandle = (Get-Process –id $pid).MainWindowHandle
@ducke
ducke / http_server.ps1
Created October 19, 2015 15:47 — forked from nobodyguy/http_server.ps1
Powershell HTTP server in background thread (could be easily killed)
$ServerThreadCode = {
$listener = New-Object System.Net.HttpListener
$listener.Prefixes.Add('http://+:8008/')
$listener.Start()
while ($listener.IsListening) {
$context = $listener.GetContext() # blocks until request is received
$request = $context.Request