This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$servers = Get-Content -Path C:\servers.txt | |
$folder = 'C:\Foo' | |
$user = 'foo' | |
$pass = 'password' | |
$secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force | |
$cred = New-Object System.Management.Automation.PSCredential ($user, $secpasswd) | |
$servers | foreach { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##foo.psm1 | |
##################### | |
$ServiceAppMap = @{ | |
RAS = 'Web' ## DeployWebApplication | |
EDW = 'Custom' ## Has it's own Install-<App> function | |
LSA = 'Custom' | |
LDI = 'Custom' | |
LDA = 'Web' | |
LAE = 'Web' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-CacheOptions | |
{ | |
[CmdletBinding()] | |
[OutputType('bool')] | |
param( | |
[Parameter(Mandatory=$true)] | |
[System.Web.Services.Protocols.SoapHttpClientProtocol]$ssrsproxy, | |
[Parameter(Mandatory=$true)] | |
[string]$path | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##################### | |
## Module mymodule.psm1 in C:\Program Files\WindowsPowerShell\Modules\MyModule | |
function foo { | |
} | |
#################### | |
#################### | |
## script.ps1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### foo.ps1 | |
Get-Module | |
## foo.Tests.ps1 | |
describe 'foo' { | |
mock 'Get-Module' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Pester - Describe block (Unit Test, Exported Function)": { | |
"prefix": "descu", | |
"body": [ | |
"describe '${name}' {", | |
"", | |
"\t$$commandName = '${name}'", | |
"", | |
"\tcontext 'Help' {", | |
"\t\t", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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({}) }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ErrorActionPreference = "Stop" | |
try | |
{ | |
$passedArgs = Parse-Args $args | |
$definedParams = @( | |
@{ Name = 'Address'; Mandatory = $true } | |
@{ Name = 'InterfaceAlias'; Mandatory = $true } | |
@{ Name = 'State'; Mandatory = $true } |