Skip to content

Instantly share code, notes, and snippets.

View PSingletary's full-sized avatar
πŸ”
Search

PSingletary PSingletary

πŸ”
Search
View GitHub Profile
@PSingletary
PSingletary / New-HTMLDiskReport.ps1
Created October 15, 2018 14:23 — forked from jdhitsolutions/New-HTMLDiskReport.ps1
A PowerShell function to create an html report showing drive utilization. Includes tooltip popup details and a color gradient.
#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.
@PSingletary
PSingletary / Get-ScreenShot.ps1
Created November 19, 2018 00:40 — forked from guitarrapc/Get-ScreenShot.ps1
Screenshot Automation with PowerShell
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)]
@PSingletary
PSingletary / Get-ProcessMemory.ps1
Created December 28, 2018 21:23 — forked from jdhitsolutions/Get-ProcessMemory.ps1
A PowerShell function to display a snapshot of process memory usage based on the workingset value. The file includes a format.ps1xml file.
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
@PSingletary
PSingletary / Script-Template-WithCreds.ps1
Created January 10, 2019 18:42 — forked from davefunkel/Script-Template-WithCreds.ps1
PowerShell Script Template with Saved Creds
<#
.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.
@PSingletary
PSingletary / BoxPrompt.ps1
Created January 19, 2019 00:16 — forked from jdhitsolutions/BoxPrompt.ps1
A fancy PowerShell prompt function that should work cross-platform. See script comments for more information.
#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>
@PSingletary
PSingletary / Get-Something.ps1
Created February 12, 2019 20:20 — forked from jdhitsolutions/Get-Something.ps1
My PowerShell function template for getting information from remote computers. The file also contains a json entry for a PowerShell snippet in VSCode.
Function Get-Something {
<#
.SYNOPSIS
Get something
.DESCRIPTION
Describe what this does.
Many of the parameters are the same as in Invoke-Command.
@PSingletary
PSingletary / mklink.psm1
Created April 3, 2019 14:58 — forked from jpoehls/mklink.psm1
Native PowerShell wrapper for MKLINK.
$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
$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
@PSingletary
PSingletary / slideshare-dl.py
Created August 1, 2019 20:04 — forked from julionc/slideshare-dl.py
slideshare-dl is a small command-line program for downloading slides from SlideShare.net
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
slideshare-dl.py
~~~~~~~~~~~~~~~~
slideshare-dl is a small command-line program
for downloading slides from SlideShare.net