Skip to content

Instantly share code, notes, and snippets.

@peppekerstens
peppekerstens / Out-Gridview.ps1
Last active June 6, 2023 11:51
Out-Gridview proxy function to include Out-ConsoleGridView
function Out-Gridview{
<#
.Synopsis
Proxy function for Out-Gridview to include parameter -ViewDefault.
.Description
Adds the parameter -ViewDefault to support Out-ConsoleGridView without impacting existing scripts or current $PSStyle standards.
When loaded and called
- with parameter -ViewDefault, this will set a hidden file within the profile of current user named .out-gridview.settings
- if the file exists, it will check the preferred setting and set a global variable OutGridviewSettings
- if the global variable exists, it will use that variable ofr loading settings
@peppekerstens
peppekerstens / gist:f0421ea484a512b75c5c4e0016a9edd1
Created December 2, 2022 09:45
Powershell smartmatch - simple replace subset spec char for -like and -match functions
function smartmatch{
param(
[string]$inputstring
)
if ($inputstring -match '\[') {
$inputstring = $inputstring.replace("[","\[")
}
if ($inputstring -match '\]'){
$inputstring = $inputstring.replace("]","\]")
}