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
# NOTE: Hard-coded to 64bit, default install, MaintenanceService off | |
$FFxVersion = '44.0' | |
$locale = 'en-US' | |
$Downloads = Convert-Path $Home\Downloads | |
$IsoPath = Join-Path $Downloads agent.iso | |
$FFxPath = Join-Path $Downloads ffx.exe | |
$ProgressPreference = "SilentlyContinue" | |
Invoke-WebRequest "https://download.mozilla.org/?product=firefox-${FFxversion}-SSL&os=win64&lang=${locale}" -Outfile $FFxPath |
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
## AutoGenerated file. Do Not Edit. Regenerate by running | |
## Add-UIModule -AssemblyName System.Windows.Controls.Ribbon -Name Ribbon | |
@{ | |
ModuleVersion = '1.0' | |
RequiredModules = 'ShowUI' | |
RequiredAssemblies = 'System.Xaml','System.Windows.Controls.Ribbon' | |
ModuleToProcess = 'Ribbon.psm1' | |
GUID = 'b307ebad-cfb1-4c34-895c-471792c513db' | |
FunctionsToExport = @('New-KeyTipControl','New-RibbonContextualTabGroupsPanel','New-RibbonGalleryCategoriesPanel','New-RibbonGalleryItemsPanel','New-RibbonGroupItemsPanel','New-RibbonGroupsPanel','New-RibbonMenuItemsPanel','New-RibbonQuickAccessToolBarOverflowPanel','New-RibbonQuickAccessToolBarPanel','New-RibbonTabHeadersPanel','New-RibbonTabsPanel','New-RibbonTitlePanel','New-StarLayoutInfo','New-Ribbon','New-RibbonMenuButton','New-RibbonApplicationMenu','New-RibbonMenuItem','New-RibbonApplicationMenuItem','New-RibbonSplitMenuItem','New-RibbonApplicationSplitMenuItem','New-RibbonButton','New-RibbonCheckBox','New-RibbonComboBox','New-RibbonContextMenu','New-Ri |
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-ParseResults { | |
param( | |
# The script or file path to parse | |
[Parameter(Mandatory=$true, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)] | |
[Alias("Path","PSPath")] | |
$Script | |
) | |
$ParseErrors = $null | |
$Tokens = $null |
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
Import-Module poke -Force | |
$xlr8r = [psobject].assembly.gettype("System.Management.Automation.TypeAccelerators") | |
# ScriptBlock Parsing using a Parser Instance so we can pass it to the DefineTypeHelper later | |
function New-Type { | |
param( | |
[ScriptBlock]$TypeDefinition, |
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
# In the real world, I'm trying to use Nancy.NancyModule, but for demo's sake, it can be this simple: | |
add-type @' | |
namespace Nancy | |
{ | |
public abstract class NancyModule | |
{ | |
protected NancyModule() { } | |
} | |
} | |
'@ |
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
$Processor, $Privileged = Get-CounterLocalizedName "Processor", "% Privileged Time" | |
Get-Counter "\$Processor(_Total)\$Privileged" |
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 Stop-ChildProcess { | |
[CmdletBinding(SupportsShouldProcess=$true)] | |
param( | |
[Parameter(ValueFromPipelineByPropertyName=$true, ParameterSetName="Name")] | |
[String[]]$Name, | |
[Parameter(ValueFromPipelineByPropertyName=$true, ParameterSetName="ID")] | |
[Alias("ProcessID")] | |
[Int[]]$ID, |
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 Tail-File { | |
[CmdletBinding()] | |
param($Path, | |
[System.Text.Encoding]$Encoding = $([System.Text.Encoding]::UTF8) | |
) | |
$File = Convert-Path $Path | |
try { | |
$Stream = New-Object System.IO.FileStream $File, "Open", "Read", "ReadWrite", 2048, "None" | |
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( | |
# If you want to try the bing images from other countries, fiddle around with this (try en-GB, for instance) | |
$Culture = 'en-US', | |
# If you want to (re)use yesterday's wallpapers, fiddle around with this | |
$Offset = 0 | |
) | |
Add-Type -Assembly System.Windows.Forms, PresentationFramework | |
Add-Type -Name Windows -Namespace System -MemberDefinition @' |
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 {} | |
} |