Skip to content

Instantly share code, notes, and snippets.

View duffney's full-sized avatar
⌨️
Coding

Josh Duffney duffney

⌨️
Coding
View GitHub Profile
Resources:
Ec2Instance:
Type: AWS::EC2::Instance
Properties:
ImageId: ami-0a9ca0496f746e6e0
InstanceType: t2.micro
Tags:
- Key: Name
Value: "WinTest01"
- Key: NameOfService
@duffney
duffney / TeamCityAgentDSC.Build.ps1
Created September 19, 2017 12:14
TeamCityAgentDSC build script as of 9-19-2017
task . InstallDependencies, Analyze, Test, UpdateVersion, Clean, Archive
task InstallDependencies {
Install-Module Pester -Force
Install-Module PSScriptAnalyzer -Force
}
task Analyze {
$scriptAnalyzerParams = @{
Path = "$BuildRoot\DSCClassResources\TeamCityAgent\"
@duffney
duffney / Enable-IISRemoteManagement.ps1
Created September 6, 2017 12:00
Enable-IISRemoteManagement.ps1
function Enable-IISRemoteManagement {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[ValidateScript({
if (-not (Test-Connection -ComputerName $_ -Quiet -Count 1)) {
throw "The computer [$_] could not be reached."
} else {
$true
}})]
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
. "$here\$sut"
Describe "Add-ACLAccessRule Tests" {
New-Item -Name Logs -Path 'TestDrive:' -ItemType Directory
$application = 'DevOpsTest'
function Add-AclAccessRule {
<#
.SYNOPSIS
Adds an access rule to an existing ACL on a folder or file.
.DESCRIPTION
Use .net methods to get the current ACL of the file or folder then generates a new rule
to which is added to the ACL of the file system object
.EXAMPLE
$splat = @{
Path = 'C:\Logs'
@duffney
duffney / LCMPull.ps1
Last active May 4, 2017 07:23
LCM configuration to connect the pull server to the client node
[DSCLocalConfigurationManager()]
Configuration LCM_Pull {
Node Pull {
Settings {
ConfigurationMode = 'ApplyAndAutoCorrect'
RefreshMode = 'Pull'
}
@duffney
duffney / WebServer.ps1
Created March 6, 2017 13:16
Simple Web Server DSC Configuration for a DSC Pull Server
Configuration WebServer {
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
Import-DscResource -ModuleName "xWebAdministration"
Node WebServerConfig {
WindowsFeature WindowsServer {
Name = 'Web-Server'
}
@duffney
duffney / DscPullServer.ps1
Last active May 4, 2017 07:10
DSC config for v2 of the pull server
configuration DscPullServer
{
param
(
[string[]]$NodeName = 'localhost',
[ValidateNotNullOrEmpty()]
[string] $certificateThumbPrint,
[Parameter(Mandatory)]
function New-DomainSignedCertificate {
[CmdletBinding()]
param(
[parameter(Mandatory=$true)]
[string]
$Hostname,
[parameter(Mandatory=$true)]
[string]
$Organization,
@duffney
duffney / DSCPullServerLab.psd1
Last active November 27, 2017 17:41
Configuration data for DSC pull server lab environment provisioning with Lability.
@{
AllNodes = @(
@{
NodeName = '*'
Lability_SwitchName = 'External'
DomainName = 'globomantics.com'
Lability_StartupMemory = 2GB;
PSDscAllowPlainTextPassword = $true;
}