Skip to content

Instantly share code, notes, and snippets.

@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%"
}

PowerShell modules, digital signatures, NuGet nuspec and packages

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

@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.
#
@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: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
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[string]$VMName,
[Parameter(Mandatory)]
[string]$OutputFile
)
function Get-DriveType($drive)
<powershell>
write-output "Running User Data Script"
write-host "(host) Running User Data Script"
cmd.exe /c net user /add vagrant FooBar@123
cmd.exe /c net localgroup administrators vagrant /add
Set-ExecutionPolicy -ExecutionPolicy bypass -Force
# RDP
#Requires -RunAsAdministrator
#Requires -Version 3.0
#References:
#Getting Started with Nano Server <https://technet.microsoft.com/en-us/library/mt126167.aspx>
#Quick Guide - Deploying Nano Server using PowerShell <http://deploymentresearch.com/Research/Post/479/Quick-Guide-Deploying-Nano-Server-using-PowerShell>
param (
#[ValidateScript({ Test-Path $_ })]
$ConvertWindowsImageScriptPath = 'D:\work\NanoServerSetup\Convert-WindowsImage.ps1'
secedit /export /cfg c:\secpol.cfg
(gc C:\secpol.cfg).replace("PasswordComplexity = 1", "PasswordComplexity = 0") | Out-File C:\secpol.cfg
secedit /configure /db c:\windows\security\local.sdb /cfg c:\secpol.cfg /areas SECURITYPOLICY
rm -force c:\secpol.cfg -confirm:$false
$admin=[adsi]"WinNT://./Administrator,user"
$admin.psbase.rename("vagrant")
$admin.SetPassword("vagrant")
$admin.UserFlags.value = $admin.UserFlags.value -bor 0x10000
$admin.CommitChanges()
<#
.SYNOPSIS
Cmdlet help is awesome. Autogenerate via template so I never forget.
.DESCRIPTION
.PARAMETER
.PARAMETER
.INPUTS
.OUTPUTS