Skip to content

Instantly share code, notes, and snippets.

######################################################
## Boxstarter Dev box install script
######################################################
# Instructions:
#
# To run this, use Internet Exploder and go to http://boxstarter.org/package/url?https://raw.githubusercontent.com/<UPDATE>
# more instructions at http://boxstarter.org/LearnWebLauncher
######################################################
cinst 7zip
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine")
$rubyExeFilePath = (Get-Command ruby.exe).Path
get-module -listavailable
Write-Host $env:PSModulePath
Import-Module NetSecurity
require 'json'
module Promote
class Versioner
def initialize(config = Config.new)
@config = config
end
def version_cookbook(cookbook_name)
cookbook = Cookbook.new(cookbook_name, config)
if(!(Test-Path "$home\test1.txt")) {
new-Item $home\test1.txt -value "hi1" -type file
write-host "reboot 1"
return Invoke-Reboot
}
if(!(Test-Path "$home\test2.txt")) {
new-Item $home\test2.txt -value "hi1" -type file
write-host "reboot 2"
return Invoke-Reboot
}
@mwrock
mwrock / gist:5cd2b2f8fc8148c453e2
Created February 16, 2015 20:27
vsphere driver transport
def transport_for(machine_spec, machine_options, vm)
if is_windows?(vm)
create_winrm_transport(machine_spec, machine_options, vm)
else
create_ssh_transport(machine_spec, machine_options, vm)
end
end
def create_winrm_transport(machine_spec, machine_options, vm)
require 'chef_metal/transport/winrm'
@mwrock
mwrock / Assert-Authentication.ps1
Created January 28, 2015 20:42
clc-powershell
function Assert-Authentication {
[CmdletBinding()]
param(
[switch]$Force
)
if(!$script:AuthSession -Or $Force) {
$creds = Get-CLCAPICredentials -ActiveCredential
if(!$Creds){
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #converge action: [{:from=>"C:/Users/Matt/AppData/Local/Temp/winrm_upload20141228-27984-1tdcu5e.zip", :to=>"/tmp/kitchen", :message=>"#< CLIXML\r\nC:\\Users\\Administrator\\AppData\\Local\\Temp\\tmp35CE.tmp\r\n<Objs Version=\"1.1.0.1\" xmlns=\"http://schemas.microsoft.com/powershell/2004/04\"><S S=\"Error\">Exception calling \"Open\" with \"3\" argument(s): \"Access to the path _x000D__x000A_</S><S S=\"Error\">'C:\\tmp\\kitchen' is denied.\"_x000D__x000A_</S><S S=\"Error\">At line:8 char:11_x000D__x000A_</S><S S=\"Error\">+ $file = [System.IO.File]::Open($destFile,_x000D__x000A_</S><S S=\"Error\">+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~_x000D__x000A_</S><S S=\"Error\"> + CategoryInfo : NotSpecified: (:) [], MethodInvocationException_x000D__x000A_</S><S S=\"Error\"> + FullyQualifiedErrorId : UnauthorizedAccessException_x000D__x000A_</S><S S=\"Error\"> _x000D__x000A_</S><S S
@mwrock
mwrock / remove.ps1
Created November 20, 2014 23:08
Removing autologon
$winLogonKey="HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
@("DefaultUserName","DefaultDomainName","DefaultPassword","AutoAdminLogon") | % {
Remove-ItemProperty -Path $winLogonKey -Name $_ -ErrorAction SilentlyContinue
}
@mwrock
mwrock / nuspec.ps1
Last active August 29, 2015 14:08
nuspec in powershell
@{
version = '11.0.1'
authors = @('Microsoft')
owners = @('Matt Wrock')
projectUrl = 'http://www.microsoft.com/visualstudio/11/en-us'
licenseUrl = 'http://msdn.microsoft.com/en-US/cc300389.aspx'
iconUrl = 'https://github.com/mwrock/Chocolatey-Packages/raw/master/VisualStudio2012Ultimate/vs.png'
id = 'VisualStudio2012Professional'
title = 'Visual Studio 2012 - Professional'
requireLicenseAcceptance = $false