This file contains hidden or 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 System; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication1 | |
{ | |
public class Thrower | |
{ | |
public string Throw() | |
{ | |
throw new System.Exception("some exception"); |
This file contains hidden or 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
New-Module m { | |
function SomeScriptblockInvoker { | |
param | |
( | |
[Parameter(Position = 1)] | |
[scriptblock] | |
$Scriptblock, | |
[Parameter(ValueFromPipeline)] | |
$InputObject |
This file contains hidden or 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
Add-Type @" | |
public class NullsafeString : System.IEquatable<string>,System.IConvertible | |
{ | |
public string Value = null; | |
public NullsafeString(string v = null) | |
{ | |
Value = v; | |
} |
This file contains hidden or 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
$guid = [guid]::NewGuid().Guid | |
$guidFrag = $guid.Split('-')[0] | |
$h = @{} | |
$h.MyInvocation = $MyInvocation | |
$directlyInvoked = -not [bool]$h.MyInvocation.Line | |
$h.TempTestScript = "$([System.IO.Path]::GetTempPath())\$guidFrag.Tests.ps1" | |
function Set-PesterVersion | |
{ | |
[CmdletBinding()] |
This file contains hidden or 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
Import-Module Pester | |
Import-Module AzureRM.Resources | |
Get-Command New-AzureRmResourceGroupDeployment | % ModuleName | |
[string](Get-Module AzureRM.Resources).Version | |
$PSVersionTable | |
Push-Location (Get-Module Pester).ModuleBase | |
$allVersions = git tag | | |
% { |
This file contains hidden or 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
$guid = '2282bfa0-cfdc-4ee5-a7a4-7aca5b33dc9f' | |
$workingFolderPath = "$([System.IO.Path]::GetTempPath())$guid" | |
$moduleContents = [ordered]@{ | |
NoClasses = @{ | |
Root = @' | |
Import-Module "$PSScriptRoot\Sub.psm1" -Args $Args | |
$passedArgs = $Args | |
function Get-PassedArgsRoot1 { $passedArgs } | |
function Get-PassedArgsRoot2 { $passedArgs } |
This file contains hidden or 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
$record = @{} | |
$guid = [guid]::NewGuid().Guid | |
$tempPath = "$([System.IO.Path]::GetTempPath())FileResourceTest" | |
Describe 'File' { | |
Context 'setup' { | |
$fqClassName = @{ | |
Namespace = 'root/microsoft/windows/DesiredStateConfiguration' | |
ClassName = 'MSFT_FileDirectoryConfiguration' |
This file contains hidden or 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
PS C:\> Trace-Command ParameterBinding { 'string' | Test-Discrimination } -PSHost | |
DEBUG: ParameterBinding Information: 0 : BIND NAMED cmd line args [Test-Discrimination] | |
DEBUG: ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [Test-Discrimination] | |
DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Test-Discrimination] | |
DEBUG: ParameterBinding Information: 0 : BIND arg [] to parameter [String] | |
DEBUG: ParameterBinding Information: 0 : Executing DATA GENERATION metadata: | |
[System.Management.Automation.ArgumentTypeConverterAttribute] | |
DEBUG: ParameterBinding Information: 0 : result returned from DATA GENERATION: | |
DEBUG: ParameterBinding Information: 0 : COERCE arg to [System.String] | |
DEBUG: ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed. |
This file contains hidden or 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 'DSC Health' { | |
It 'KB3176934 is not installed' { | |
# https://blogs.msdn.microsoft.com/powershell/2016/08/23/powershell-dsc-broken-in-kb3176932/ | |
$r = Get-Hotfix -Id KB3176934 -ea SilentlyContinue | |
$r | Should beNullOrEmpty | |
} | |
} |
This file contains hidden or 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
gwmi -Namespace 'root\cimv2\dell' -list | |
NameSpace: ROOT\cimv2\dell | |
Name Methods Properties | |
---- ------- ---------- | |
__SystemClass {} {} | |
__thisNAMESPACE {} {SECURITY_DESCRIPTOR} |
NewerOlder