π
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 3.0 | |
Function New-HTMLDiskReport { | |
<# | |
.Synopsis | |
Create a disk utilization report with gradient coloring | |
.Description | |
This command will create an HTML report depicting drive utilization through a gradient color bar. |
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 Get-ScreenShot | |
{ | |
[CmdletBinding()] | |
param( | |
[parameter(Position = 0, Mandatory = 0, ValueFromPipelinebyPropertyName = 1)] | |
[ValidateNotNullOrEmpty()] | |
[string]$OutPath = "$env:USERPROFILE\Documents\ScreenShot", | |
#screenshot_[yyyyMMdd_HHmmss_ffff].png | |
[parameter(Position = 1, Mandatory = 0, ValueFromPipelinebyPropertyName = 1)] |
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 Get-ProcessMemory { | |
<# | |
.SYNOPSIS | |
Get a snapshot of a process' memory usage. | |
.DESCRIPTION | |
Get a snapshot of a process' memory usage based on its workingset value. You can get the same information using Get-Process or by querying the Win32_Process WMI class with Get-CimInstance. This command uses Invoke-Command to gather the information remotely. Many of the parameters are from that cmdlet. | |
Technically you can use wildcards with process names, but because of how the function aggregates data, you might not see the results you expect. | |
.EXAMPLE | |
PS C:\> get-processmemory code,powershell,powershell_ise |
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 | |
The synopsis goes here. This can be one line, or many. | |
This version of the template has inbuilt functions to capture credentials and store it securely for reuse | |
Avoids the need to have plaintext passwords in the script | |
.DESCRIPTION | |
The description is usually a longer, more detailed explanation of what the script or function does. | |
Take as many lines as you need. |
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 | |
<# | |
Create a lined box with user and location information. The line color will indicate if the user is running elevated. | |
The prompt will also display the current date and time and a PS prompt with the PowerShell version. | |
βββββββββββββββββββββββββββ | |
β [BOVINE320\Jeff] D:\iso β | |
βββββββββββββββββββββββββββ | |
[01/18/2019 09:30:53] PS v6.1.2> |
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 Get-Something { | |
<# | |
.SYNOPSIS | |
Get something | |
.DESCRIPTION | |
Describe what this does. | |
Many of the parameters are the same as in Invoke-Command. |
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-Symlink { | |
<# | |
.SYNOPSIS | |
Creates a symbolic link. | |
#> | |
param ( | |
[Parameter(Position=0, Mandatory=$true)] | |
[string] $Link, | |
[Parameter(Position=1, Mandatory=$true)] | |
[string] $Target |
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
$URL = 'https://aka.ms/wsl-ubuntu-1804' | |
$Filename = "$(Split-Path $URL -Leaf).appx" | |
$ProgressPreference = 'SilentlyContinue' | |
Invoke-WebRequest -Uri $URL -OutFile $Filename -UseBasicParsing | |
Invoke-Item $FileName |
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
$URLs = "https://aka.ms/wsl-ubuntu-1804" ,"https://aka.ms/wsl-ubuntu-1804-arm" ,"https://aka.ms/wsl-ubuntu-1604" ,"https://aka.ms/wsl-debian-gnulinux" ,"https://aka.ms/wsl-kali-linux" ,"https://aka.ms/wsl-opensuse-42" ,"https://aka.ms/wsl-sles-12" | |
$ProgressPreference = 'SilentlyContinue' | |
$ErrorActionPreference = 'Stop' | |
Foreach($URL in $URLs){ | |
$Filename = "$(Split-Path $URL -Leaf).appx" | |
Write-Host "Downloading: $Filename" -Foreground Yellow -NoNewline | |
try{ | |
Invoke-WebRequest -Uri $URL -OutFile $Filename -UseBasicParsing | |
Add-AppxPackage -Path $Filename |