This file contains 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
# https://github.com/dfinke/Posh-Gist | |
# Send-Gist | |
# Copy of the Gist-Functions, with focus on Send-Gist | |
# You need a GitHub account to post a gist, this does not support anonymous posts. | |
# Remember that the param statement should be the first one in a PowerShell script. | |
param([string]$Path, [string]$Description) | |
This file contains 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
# https://github.com/dfinke/Posh-Gist | |
# Get-Gist | |
# Copy of the Gist-Functions, with focus on Get-Gist | |
# You need a GitHub account to post a gist, this does not support anonymous posts. | |
# Remember that the param statement should be the first one in a PowerShell script. | |
param( | |
[Parameter(Mandatory)] | |
[string]$User, |
This file contains 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
#################### | |
# Isolate as much as possible away from $profile. All functions should be in Modules whenever possible | |
#################### | |
# Module: Common-Tools | |
# Collection of helper functions to constantly update | |
function syntax($cmd) { Get-Command $cmd -Syntax } # or (Get-Command $cmd).Definition | |
function parameter($cmd, $parameter) { Get-Help $cmd -Parameter $parameter } | |
function examples($cmd) { Get-Help $cmd -Examples } # or (Get-Command $cmd).Definition |
This file contains 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
Just some notes on git ... | |
Install git from git-scm.com | |
https://www.youtube.com/watch?v=SWYqp7iY_Tc | |
https://guides.github.com/activities/hello-world/ # Quick guide from GitHub | |
Create folder and put stuff in it. | |
# git init | |
# git add <filename> # add <filename> | |
# git add . # add all files in folder | |
# git status # show added / not added / changed files |
This file contains 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
######################################## | |
# | |
# BeginSystemConfig.ps1 | |
# iex ((New-Object System.Net.WebClient).DownloadString('https://bit.ly/2R7znLX')); | |
# | |
# Author: [email protected] | |
# | |
# 2019-11-25 Initial setup | |
# 2020-10-19 Latest Version | |
# |
This file contains 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
######################################## | |
# | |
# ProfileExtensions.ps1 | |
# | |
# The profile extensions is normally called by a single line that is added to | |
# the end of $Profile, or can be dotsourced manually if required. | |
# | |
# The handler line in $Profile performs the following: | |
# a) It check if $($Profile)_extensions.ps1 exists, if not download it. | |
# b) It then runs (dotsource) $($Profile)_extensionss.ps1. |
This file contains 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
#################### | |
# | |
# Custom-Tools.psm1 | |
# Current Version: 2020-10-24 | |
# | |
# Module is installed to the Module folder visible to all users (but can only be modified by Administrators): | |
# C:\Program Files\WindowsPowerShell\Modules\Custome-Tools | |
# | |
# The Module contains only functions to access on demand as required. | |
# mods : View all Modules installed in all PSModulePath folders. |
This file contains 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
# How do I download URL content using Get-Content in PowerShell Script? | |
# Assumes that you have a URL on each line in C:\Urls.txt. It will put the files in a folder at C:\UrlOutput. If that’s not where you want them, just change the $OutputFolder variable value appropriately. | |
$Urls = Get-Content "C:\Urls.txt" | |
$OutputFolder = "C:\UrlOutput" | |
if(!(Test-Path $OutputFolder)){ New-Item -ItemType Directory -Path $OutputFolder -Force | Out-Null } | |
for ($x = 0; $x -lt ($Urls | measure | select -expand Count); $x++) | |
{ |
This file contains 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
# Find definitions for any Cmdlet, Function, Alias, External Script, Application, or Variable | |
function what { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory)] | |
[ArgumentCompleter({ [Management.Automation.CompletionResult]::Command })] | |
$cmd, | |
[switch]$Examples | |
) | |
# Previously declared $cmd as [string]$cmd but this was wrong as cannot then handle arrays or anything else |