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
#requires -version 5.1 | |
<# | |
Based on a function from https://gist.github.com/dhmacher/2203582502c7ab13015db8f52e94da45 | |
You need an access token that has at least write access to your status | |
* go to settings -> Development | |
* Click "New Application" | |
* Enter a name |
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
#requires -version 5.1 | |
#set a temporary environment variable | |
# example using the function alias and positional parameters: se rust_log debug | |
Function Set-EnvironmentVariable { | |
[CmdletBinding(SupportsShouldProcess)] | |
[alias("se")] | |
Param ( | |
[Parameter(Position = 0, Mandatory)] | |
[ValidateNotNullOrEmpty()] |
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 ConvertTo-PSClass { | |
[cmdletbinding()] | |
[outputType([String])] | |
Param( | |
[Parameter(Position = 0, Mandatory, ValueFromPipeline)] | |
[ValidateNotNullOrEmpty()] | |
[object]$InputObject, | |
[Parameter(Mandatory, HelpMessage = "Enter the name of your new class")] | |
[ValidatePattern("^\w+$")] | |
[string]$Name, |
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
#requires -version 7.2 | |
#requires -module ThreadJob | |
if ($IsLinux -OR $IsMacOS) { | |
Return "$($PSStyle.foreground.red)This command requires a Windows platform.$($PSStyle.Reset)" | |
} | |
if ($host.name -ne "ConsoleHost") { | |
Return "$($PSStyle.foreground.red)Detected $($host.name). This command must be run from a PowerShell 7.x console prompt.$($PSStyle.Reset)" | |
} | |
Function Get-WinEventReport { |
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
#requires -version 7.2 | |
Function Get-Status { | |
[cmdletbinding(DefaultParameterSetName = 'name')] | |
[alias("gst")] | |
Param( | |
[Parameter( | |
Position = 0, | |
ValueFromPipeline, | |
ValueFromPipelineByPropertyName, |
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
#requires -version 5.1 | |
#Get-HostPrivateData.ps1 | |
#for best results run these commands in a PowerShell console | |
Function Get-HostPrivateData { | |
[cmdletbinding()] | |
[outputtype("PSHostPrivateData")] | |
Param() | |
<# |
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
#requires -version 5.1 | |
#requires -RunasAdministrator | |
#requires -module AnyBox | |
# https://www.fresh2.dev/doc/anybox/ | |
# this is a revised version of the example at https://github.com/fresh2dev/AnyBox/blob/main/Examples/Process-Mgr.ps1 | |
Param([string]$Computername = $env:Computername) | |
$anybox = New-Object AnyBox.AnyBox |
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
#requires -version 5.1 | |
<# | |
.Synopsis | |
Create System Report | |
.Description | |
Create a system status report with information gathered from WMI using Get-CimInstanxce. T | |
he default output to the pipeline is a collection of custom objects. You can also use -TEXT | |
to write a formatted text report, suitable for sending to a file or printer, or -HTML to |
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
#requires -version 7.1.2 | |
Return "This is a walk-through demo script file" | |
#region demo prep | |
# Are you running in PowerShell 7? | |
#make my errors easier to read | |
$host.PrivateData.ErrorForegroundColor = "yellow" | |
#clear any default settings |
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
#requires -version 7.2 | |
<# | |
These commands can be used to export FileInfo settings from $PSStyle and | |
then import them in another session. You might use the import command in | |
your PowerShell profile script. The file must be a json file. | |
#> | |
Function Export-PSStyleFileInfo { | |
[cmdletbinding(SupportsShouldProcess)] | |
Param( |