Skip to content

Instantly share code, notes, and snippets.

View PSingletary's full-sized avatar
🔍
Search

PSingletary PSingletary

🔍
Search
View GitHub Profile
@PSingletary
PSingletary / Add-NetworkLocation_function.ps1
Last active November 16, 2024 08:16
Powershell Function to create a Network Location based on a name and a target path
<#
.SYNOPSIS
create a Network Location based on a name and a target path
.DESCRIPTION
create a Network Location based on a name and a target path
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
.INPUTS
<Inputs if any, otherwise state None>
.OUTPUTS
@PSingletary
PSingletary / shortpath.bat
Created December 12, 2017 14:30
convert entries in PATH to 8.3 format to gain more character space
REM http://stackoverflow.com/questions/4405091/how-avoid-over-populate-path-environment-variable-in-windows
@echo off
SET shortpath=%PATH%
echo "Old PATH documented in C:\_admin\OLDPath.txt"
echo %shortpath%
echo %shortpath% > C:\_admin\OLDPath.txt
echo --
echo "Directories not found, documented in C:\_admin\PATH_folders_not_found.txt"
#http://blogs.msdn.com/b/powershell/archive/2006/12/21/jingle.aspx
########################################################################################
function Play([int] $freq, [int] $duration)
{
[console]::Beep($freq, $duration);
}
function GetNoteFreq([string]$note)
{
# n is the number of half steps from the fixed note.
$note -match '([A-G#]{1,2})(\d+)' | out-null
@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 / get-DotNetVersions.ps1
Created December 18, 2017 12:40
PowerShell oneliner to list all the installed .NET versions on a local computer - http://www.happysysadm.com/2017/12/powershell-oneliner-to-list-all.html
<#
.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.>
.LINK
http://www.happysysadm.com/2017/12/powershell-oneliner-to-list-all.html
#>
((ls 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -rec|? name -match 'v1.1.4322$|v2.0.50727$|v3.0$|v3.5$|v4\\Full$').name -replace 'HKEY_LOCAL_MACHINE','HKLM:'|%{ Get-ItemProperty $_}).Version
@PSingletary
PSingletary / get-DotNetVersions.ps1
Created December 18, 2017 12:40
PowerShell oneliner to list all the installed .NET versions on a local computer - http://www.happysysadm.com/2017/12/powershell-oneliner-to-list-all.html
<#
.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.>
.LINK
http://www.happysysadm.com/2017/12/powershell-oneliner-to-list-all.html
#>
((ls 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -rec|? {$_.name -match 'v1.1.4322$|v2.0.50727$|v3.0$|v3.5$|v4\\Full$'} | select -expand name) -replace 'HKEY_LOCAL_MACHINE','HKLM:') -replace 'HKEY_LOCAL_MACHINE','HKLM:'|%{ Get-ItemProperty $_} | select -expand Version
@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
$sISO8601 = Get-Date -format s
#Source characters ABCDEGHJKLNPSTUYZ=#+acdeghiknopstuyz23456789
#Arrays
$array4word = "able", "case", "come", "fact", "find", "give", "hand", "have", "high", "into", "know", "last", "life", "long", "make", "next", "over", "part", "same", "take", "that", "they", "this", "time", "want", "with", "work", "year"
$array5word = "about", "after", "child", "early", "first", "great", "group", "large", "leave", "other", "place", "right", "their", "there", "thing", "think", "woman", "world", "would", "young"
$arraySpecial = "#", "+", "="
$arrayUpper = "A", "B", "C", "D", "E", "G", "H", "J", "K", "L", "N", "P", "S", "T", "U", "Y", "Z"
$arrayNumber = 2..9
#Random selection from arrays
$rand4word_1 = $array4word[(Get-Random -Maximum ($array4word).count)]
$randSpecial = $arraySpecial[(Get-Random -Maximum ($arraySpecial).count)]