Skip to content

Instantly share code, notes, and snippets.

View PSingletary's full-sized avatar
🔍
Search

PSingletary PSingletary

🔍
Search
View GitHub Profile
@PSingletary
PSingletary / Script_Template.ps1
Last active December 18, 2017 12:39 — forked from 9to5IT/Script_Template.ps1
PowerShell: Script Template
<#
.SYNOPSIS
<A brief description of the function or script. This keyword can be used only once in each topic.>
.DESCRIPTION
<A detailed description of the function or script. This keyword can be used only once in each topic.>
.PARAMETER <Parameter-Name>
<The description of a parameter. Add a ".PARAMETER" keyword for each parameter in the function or script syntax.
Type the parameter name on the same line as the ".PARAMETER" keyword. Type the parameter description on the lines following the ".PARAMETER" keyword. Windows PowerShell interprets all text between the ".PARAMETER" line and the next keyword or the end of the comment block as part of the parameter description. The description can include paragraph breaks.
[Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Interop.PowerPoint")
[Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[string] $Source = "$(Split-Path $Script:MyInvocation.MyCommand.Path -Parent)\Slide.html"
[int] $DefaultTitleHeight = 150
function Add-Textbox {
param (
[object] $Slide,
[string] $Text,
@PSingletary
PSingletary / Install-CitrixReceiver.ps1
Created December 27, 2017 14:11
Downloads and installs Citrix Receiver
<#
.SYNOPSIS
Downloads and installs Citrix Receiver.
Intended to run via Intune.
#>
# If Receiver is already installed, skip download and install
If (!(Get-WmiObject -Class Win32_Product | Where-Object Name -Like "Citrix Receiver*")) {
# Cirix Receiver download source
@PSingletary
PSingletary / Export-Chocolatey.ps1
Created December 30, 2017 01:17 — forked from alimbada/Export-Chocolatey.ps1
Export installed Chocolatey packages as packages.config - thanks to Matty666
Write-Output "<?xml version=`"1.0`" encoding=`"utf-8`"?>"
Write-Output "<packages>"
choco list -lo -r -y | % { " <package id=`"$($_.SubString(0, $_.IndexOf("|")))`" version=`"$($_.SubString($_.IndexOf("|") + 1))`" />" }
Write-Output "</packages>"
@PSingletary
PSingletary / Hundred-OneLines.psm1
Last active January 12, 2018 08:40 — forked from chrdek/Hundred-OneLines.psm1
One hundred and one (one-liners) of Powershell for Computer Info.
<#
MODULE OF:
..One-Hundred-and-One one-liners of powershell..
Author: Chris Dek.
Usage: From the powershell cmdlet run the command:
Import-Module .\Hundred-OneLines.psm1
..wait for a while to load.
@PSingletary
PSingletary / Schedule-ChocoUpgradeAll.ps1
Created January 13, 2018 11:09 — forked from dstreefkerk/Schedule-ChocoUpgradeAll.ps1
PowerShell script to create a scheduled task that runs a choco upgrade all at machine startup
# See if choco.exe is available. If not, stop execution
$chocoCmd = Get-Command -Name 'choco' -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | Select-Object -ExpandProperty Source
if ($chocoCmd -eq $null) { break }
# Settings for the scheduled task
$taskAction = New-ScheduledTaskAction –Execute $chocoCmd -Argument 'upgrade all -y'
$taskTrigger = New-ScheduledTaskTrigger -AtStartup
$taskUserPrincipal = New-ScheduledTaskPrincipal -UserId 'SYSTEM'
$taskSettings = New-ScheduledTaskSettingsSet -Compatibility Win8
@PSingletary
PSingletary / Get-PingSweep.ps1
Last active April 23, 2018 13:46 — forked from joegasper/Get-PingSweep.ps1
Get-PingSweep - super fast (~500ms) subnet ping sweep with option to resolve IP address
# Inspiration from https://twitter.com/mrhvid/status/929717169130176512 @mrhvid @Lee_Holmes
function ResolveIp($IpAddress) {
try {
(Resolve-DnsName $IpAddress -QuickTimeout -ErrorAction SilentlyContinue).NameHost
} catch {
$null
}
}
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco install 7zip /y
choco install adobereader /y
choco install anaconda3 /y
choco install azure-cli /y
choco install docker-for-windows /y
choco install firefox /y
choco install garmin-express /y
choco install git /y
#Prep
Update-ExecutionPolicy Unrestricted
Disable-UAC
#Win Config
Set-TaskbarOptions -Size Small -Lock -Dock Top
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Disable-InternetExplorerESC
@PSingletary
PSingletary / ConvertTo-Markdown.ps1
Created August 16, 2018 17:21 — forked from jdhitsolutions/ConvertTo-Markdown.ps1
Convert pipeline output to a markdown document
#requires -version 5.0
Function ConvertTo-Markdown {
<#
.Synopsis
Convert pipeline output to a markdown document.
.Description
This command is designed to accept pipelined output and create a markdown document. The pipeline output will formatted as a text block. You can optionally define a title, content to appear before the output and content to appear after the output.
The command does not create a text file. You need to pipe results from this command to a cmdlet like Out-File or Set-Content. See examples.
.Parameter Title