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
Update-TypeData -TypeName System.Management.Automation.InvocationInfo -MemberName ParameterValues -MemberType ScriptProperty -Value { | |
$results = @{} | |
foreach($parameter in $this.MyCommand.Parameters.GetEnumerator()) { | |
try { | |
$key = $parameter.Key | |
if($value = Get-Variable -Name $key -Scope 1 -ValueOnly -ErrorAction Ignore) { | |
$results.$key = $value | |
} | |
} finally {} | |
} |
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
PS> mkdir ClassContainer | |
Directory: C:\Users\Joel\Documents\WindowsPowerShell\TestData\modules | |
Mode LastWriteTime Length Name | |
---- ------------- ------ ---- | |
d----- 11/23/2015 7:41 PM ClassContainer |
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
// You can output any simple .Net Object that you like | |
using System; | |
using System.Collections.Generic; | |
using System.Management.Automation; | |
namespace PoshCode | |
{ | |
// A data object we're going to output | |
public class Vehicle | |
{ |
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
<?xml version="1.0" encoding="utf-8"?> | |
<key name="Software"> | |
<key name="ConEmu"> | |
<key name=".Vanilla" modified="2015-12-30 15:59:33" build="151224"> | |
<value name="StartType" type="hex" data="02"/> | |
<value name="CmdLine" type="string" data=""/> | |
<value name="StartTasksFile" type="string" data=""/> | |
<value name="StartTasksName" type="string" data="{PowerShell}"/> | |
<value name="StartFarFolders" type="hex" data="00"/> | |
<value name="StartFarEditors" type="hex" data="00"/> |
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
PS$ @' | |
>> [CmdletBinding()]param() | |
>> | |
>> Write-Host "Imagine you're doing some work and you call a command from my module..." | |
>> Test-Failures "Throw" -ErrorAction Continue | |
>> '@ > ~\Documents\WindowsPowerShell\Scripts\TestFailureMode.ps1 | |
PS$ ~\Documents\WindowsPowerShell\Scripts\TestFailureMode.ps1 | |
Imagine you're doing some work and you call a command from my 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
Verifying that +jaykul is my blockchain ID. https://onename.com/jaykul |
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
<#PS #> Add-Type @" | |
using System; | |
using System.Collections.Generic; | |
[Flags] | |
public enum ServicesEnum | |
{ | |
ExOnline = 1, | |
MsOnline = 2, |
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-GithubRelease { | |
[CmdletBinding()] | |
param( | |
# The user or organization that owns the repository | |
[Parameter(Mandatory)] | |
$Owner, | |
# The name of the project repository | |
[Parameter(Mandatory)] | |
$Repo, | |
# The release id. Defaults to "latest" (e.g. v15.0 or "latest") |
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
<# PS 1:#> Update-TypeData -TypeName User -MemberType AliasProperty -MemberName FirstName -Value Item1 | |
<# PS 2:#> Update-TypeData -TypeName User -MemberType AliasProperty -MemberName LastName -Value Item2 | |
<# PS 3:#> Update-TypeData -TypeName User -MemberType AliasProperty -MemberName Seniority -Value Item3 | |
<# PS 4:#> Update-TypeData -TypeName User -MemberType AliasProperty -MemberName JobRole -Value Item4 | |
<# PS 5:#> Update-TypeData -TypeName User -DefaultDisplayPropertySet @("FirstName","LastName","Seniority","JobRole") | |
<# PS 6:#> [Tuple]::Create("Joel","Bennett",11,"Principal Software Engineer") | %{ $_.PSTypeNames.Insert(0, "User"); $_ } | |
FirstName LastName Seniority JobRole | |
--------- -------- --------- ------- | |
Joel Bennett 11 Principal Software Engineer |
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 Format-Wide { | |
[CmdletBinding(HelpUri='http://go.microsoft.com/fwlink/?LinkID=113304')] | |
param( | |
[Parameter(Position=0)] | |
[System.Object] | |
${Property}, | |
[switch] | |
${AutoSize}, |