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 Register-ShellExtension { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory = $true)] | |
[string] | |
$Name, | |
[Parameter(Mandatory = $true)] | |
[string] | |
$Text, |
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
$source = @' | |
using System; | |
using System.Runtime.InteropServices; | |
namespace Shell | |
{ | |
public static class Host | |
{ | |
public static void DisableScreensaver() | |
{ | |
NativeMethods.SetThreadExecutionState(ExecutionState.DisplayRequired); |
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
$ExecutionContext.InvokeCommand.CommandNotFoundAction = { | |
param ( | |
[string] | |
$CommandName, | |
[System.Management.Automation.CommandLookupEventArgs] | |
$Lookup | |
) | |
if ($CommandName -match '^(\d+)[WD](\d+)$') |
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 Out-Default | |
{ | |
<# | |
.SYNOPSIS | |
A wrapper for Out-Default, adding automatic caching to all output sent to screen. | |
.DESCRIPTION | |
A wrapper for Out-Default, adding automatic caching to all output sent to screen. | |
Maximum capacity can be configured by setting $global:OutputCacheSize |
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
New-Module -Name Test -ScriptBlock { | |
function Get-Test1 | |
{ | |
[CmdletBinding()] | |
param () | |
$var = 24 | |
$depth = 0 | |
try | |
{ |
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-ShellBuffer | |
{ | |
[CmdletBinding()] | |
param () | |
try | |
{ | |
# Define limits | |
$rec = New-Object System.Management.Automation.Host.Rectangle | |
$rec.Left = 0 |
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
$scriptBlock = { | |
Connect-Lab | |
$id = "<id>" | |
$labname = "wsFund$($id)" | |
$domainName = "lab$($id).contoso.com" | |
$labSources = 'C:\LabSources' | |
$image = 'Windows Server 2016 Datacenter Evaluation (Desktop Experience)' | |
New-LabDefinition -Name $labname -DefaultVirtualizationEngine HyperV | |
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
#----------------------------------------------------------------------------# | |
# Parameters # | |
#----------------------------------------------------------------------------# | |
# Path to a file with server names | |
$servers = 'DC', 'AdminHost' | |
# Whether errors should be ignored | |
$ignoreErrors = $true |
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
Write-Host "Didn't really expect me to do a thing, did you?" | |
# Dummy script file for a tutorial |
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"?> | |
<Types> | |
<!-- Fred.IronScripter2018.DiskInfo --> | |
<Type> | |
<Name>Deserialized.Fred.IronScripter2018.DiskInfo</Name> | |
<Members> | |
<MemberSet> | |
<Name>PSStandardMembers</Name> | |
<Members> | |
<NoteProperty> |