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
[ | |
[ | |
], | |
[ | |
], | |
[ | |
[ | |
"System.Xml.XmlElement", |
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
<# | |
.SYNOPSIS | |
Wrap commands with DebuggerNonUserCode attribute to prevent the PowerShell debugger stepping into them | |
.DESCRIPTION | |
Generates proxy functions that wrap the original commands, and put an attribute on the proxy to prevent the debugger stopping. | |
.EXAMPLE | |
Get-Command -Module Pester | Hide-FromDebugger | |
Hides all pester functions from the debugger, so you can debug in your code without stepping into Pester functions. | |
#> |
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
describe "doing some testing" { | |
Get-Command -Module TunableSSLValidator | % { | |
It "Should not have any conflicting names for $($_.Name) function" { | |
(Get-Command $_.Name -All).count | Should -Not -BeGreaterThan 1 | |
} | |
} | |
} |
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
[cmdletbinding()] | |
param ( | |
$SourceFolder = $PSScriptRoot | |
) | |
if (-not (Get-Module PSDepend -ListAvailable)) { | |
Install-Module PSDepend -Repository (Get-PSRepository)[0].Name -Scope CurrentUser | |
} | |
Push-Location $PSScriptRoot -StackName BuildScript | |
Invoke-PSDepend -Path $SourceFolder -Confirm:$false |
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
#requires -Module Reflection | |
function Find-Dependencies { | |
param($Path) | |
Get-ParseResults $Path | | |
Find-Token { $_ -is "System.Management.Automation.Language.CommandAst" } | | |
Get-Command -Name { $_.CommandElements[0].Value } -ea continue | # Errors will appear for commands you don't have available | |
Sort Source, Name | | |
Group Source | | |
Select @{N="Module";e={$_.Name}}, @{N="Used Commands";E={$_.Group}} |
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
using Namespace System.Management.Automation.Language | |
Function Get-AliasTarget { | |
[cmdletbinding()] | |
param ( | |
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] | |
[Alias('PSPath', 'FullName')] | |
[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
################ | |
### Rollback ### | |
################ | |
# Use with : './apply_oracle_secpatch.bat -rollback' | |
Function rollback | |
{ | |
Param | |
( | |
[Parameter()] | |
[switch]$rollback |
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 New-ModuleOverview { | |
<# | |
.SYNOPSIS | |
Generates a Markdown file with a short description of each public command in a module. | |
.DESCRIPTION | |
Finds all the public commands in a specified module and produces a simple Markdown file detailing the description or synopsis (user choice) for each. | |
.PARAMETER ModuleName | |
Name of the module to generate an overview for. If the module isn't already loaded then it will be loaded. |
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-stuff { | |
param ( | |
[ValidateSet('A','b','c','d')] | |
[string]$user, | |
[ValidateNotNullOrEmpty()] | |
[string]$data | |
) | |
} |
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 test-switch { | |
param ( | |
[switch]$switch1, | |
[switch]$switch2, | |
[switch]$switch3, | |
[switch]$switch4 | |
) | |
switch ($true) { | |
$switch1 { "test1" } |
OlderNewer