Skip to content

Instantly share code, notes, and snippets.

View adbertram's full-sized avatar

Adam Bertram adbertram

View GitHub Profile
function New-TfsWorkItem
{
[OutputType([void])]
[CmdletBinding()]
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string]$Title,
function set-KCD
{
[cmdletbinding(SupportsShouldProcess = $True, ConfirmImpact = 'Medium')]
param (
[parameter(Mandatory = $True, ValueFromPipeline = $True)]
$ADObject,
[parameter(Mandatory = $True, ValueFromPipeline = $True)]
[string[]]$SPNs
)
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Adam Bertram (@adbertram)
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
$ErrorActionPreference = "Stop"
try
{
$passedArgs = Parse-Args $args
$definedParams = @(
@{ Name = 'Address'; Mandatory = $true }
@{ Name = 'InterfaceAlias'; Mandatory = $true }
@{ Name = 'State'; Mandatory = $true }
## tasks
- name: Setup app pools
win_iiswebapppool:
name: "{{ item.value.name }}"
managed_runtime_version: "{{ item.value.managed_runtime_version }}"
managed_pipeline_mode: "{{ item.value.managed_pipeline_mode }}"
with_dict: "{{ webapppools }}"
## vars
webapppools:
play
-----
- name: Folder ACLs
win_acl:
path: "{{ item.value.path }}"
user: "{{ item.value.access.user }}"
rights: "{{ item.value.access.rights }}"
propogation: "{{ item.value.access.propogation }}"
inherit: "{{ item.value.access.inherit }}"
with_dict: "{{ folders|default({}) }}"
"Pester - Describe block (Unit Test, Exported Function)": {
"prefix": "descu",
"body": [
"describe '${name}' {",
"",
"\t$$commandName = '${name}'",
"",
"\tcontext 'Help' {",
"\t\t",
(Get-Counter '\Process(*)\% Processor Time').CounterSamples | where { $_.InstanceName -notin @('idle','system','_total') } | sort cookedvalue -Descending | select -first 5 -Property InstanceName,@{n='Percent';e={[math]::Round($_.CookedValue)}}
### foo.ps1
Get-Module
## foo.Tests.ps1
describe 'foo' {
mock 'Get-Module'
#####################
## Module mymodule.psm1 in C:\Program Files\WindowsPowerShell\Modules\MyModule
function foo {
}
####################
####################
## script.ps1