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
function New-TypeDefinitionFromCsv { | |
param( | |
[Parameter(Mandatory)] | |
[string] $Path, | |
[ValidatePattern("\w[\w\d_-]*", ErrorMessage = "The typename must be a valid name of an Identifier.")] | |
[string] $NameOfGeneratedType, | |
[ArgumentCompletions('";"', '"`t"', '","')] | |
[string] $Delimiter = ',', | |
[Type[]] $ColumnType, | |
[switch] $CSharp |
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
<# | |
.SYNOPSIS | |
Sends a notification on Linux. | |
.DESCRIPTION | |
Sends a notification on Linux. Under the hood, this uses notify-send(1) | |
.PARAMETER Body | |
The body or main content of the notification. |
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
<# | |
.SYNOPSIS | |
Sends a notification on Linux. | |
.DESCRIPTION | |
Sends a notification on Linux. Under the hood, this uses notify-send(1) | |
.PARAMETER Body | |
The body or main content of the notification. |
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
<# | |
.SYNOPSIS | |
Change language settings for a PowerPoint presentation | |
.EXAMPLE | |
PS> Set-PowerPointLanguage -Path MyPres.pptx | |
Writes a copy of MyPres.pptx to MyPres.en-us.pptx with the language set to 'en-US' - English (the default) | |
.EXAMPLE | |
PS> Set-PowerPointLanguage -Path MyPres.pptx -Language de-DE |
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 namespace System.Management.Automation | |
using namespace System.Collections.Generic | |
class ArgumentCompleterBase : IArgumentCompleter { | |
hidden [List[CompletionResult]] $Results = [List[CompletionResult]]::new() | |
[string] $WordToComplete | |
[Language.CommandAst] $commandAst | |
# override in child class | |
[void] AddCompletionsFor([string] $commandName, [string] $parameterName, [Collections.IDictionary] $fakeBoundParameters) {} |
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
/// <summary> | |
/// Base class for writing custom Argument Completers | |
/// </summary> | |
/// <para>Derived classes should override <see cref="AddCompletionsFor(string,string,IDictionary)"/> </para> | |
public abstract class ArgumentCompleterBase : IArgumentCompleter | |
{ | |
private List<CompletionResult> _results; | |
/// <summary> |
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 -MemberDefinition @" | |
[DllImport("kernel32.dll", SetLastError=true)] | |
public static extern bool SetConsoleMode(IntPtr hConsoleHandle, int mode); | |
[DllImport("kernel32.dll", SetLastError=true)] | |
public static extern IntPtr GetStdHandle(int handle); | |
[DllImport("kernel32.dll", SetLastError=true)] | |
public static extern bool GetConsoleMode(IntPtr handle, out int mode); |
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 namespace System.Security.Principal | |
function ConvertFrom-SID { | |
[CmdletBinding()] | |
[OutputType([NTAccount])] | |
param([SecurityIdentifier[]] $SID) | |
$SID.Foreach{$_.Translate([NTAccount])} | |
} |
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 namespace System.Management.Automation | |
using namespace System.IO | |
using namespace System.Collections.Generic | |
class PEHeaders { | |
[String] $Path | |
[CoffHeader] $Coffheader | |
[PEHeader] $PEHeader | |
[SectionHeader[]] $SectionHeaders | |
[DebugDirectoryEntry[]] $DebugDirectoryEntires |
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
. C:\Users\Staffan\Documents\WindowsPowerShell\JoinItem.ps1 | |
class OptionHelp { | |
[string] $Short | |
[string] $Long | |
[string] $Arg | |
[string] $Help | |
} |
NewerOlder