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
#Requires -RunAsAdministrator | |
function Uninstall-Pester ([switch]$All) { | |
if ([IntPtr]::Size * 8 -ne 64) { throw "Run this script from 64bit PowerShell." } | |
#Requires -RunAsAdministrator | |
$pesterPaths = foreach ($programFiles in ($env:ProgramFiles, ${env:ProgramFiles(x86)})) { | |
$path = "$programFiles\WindowsPowerShell\Modules\Pester" | |
if ($null -ne $programFiles -and (Test-Path $path)) { | |
if ($All) { |
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
# | |
# Himawari-8 Downloader | |
# | |
# | |
# | |
# This script will scrape the latest image from the Himawari-8 satellite, recombining the tiled image, | |
# converting it to a JPG which is saved in My Pictures\Himawari\ and then set as the desktop background. | |
# | |
# http://himawari8.nict.go.jp/himawari8-image.htm | |
# |
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
function Test-NetPort { | |
[CmdletBinding()] | |
[OutputType([Boolean])] | |
param ( | |
[Parameter(Mandatory, | |
ValueFromPipeline, | |
ValueFromPipelineByPropertyName)] | |
[String] $ComputerName, | |
[Parameter(Mandatory, |
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
Function GenerateScriptDocumentationInMarkdown { | |
<# | |
.Synopsis | |
Generates documentation for a folder-full of scripts using the integrated Get-Help CMDlets. | |
.Description | |
Generates a .markdown documentat for each PS1 script in a folder which has the necessary headers required by Get-Help. Also generates an index document which lists (and links to) all generated documentats. Each file name is preceeded with "script_ps1_" so that they are listed together when viewing the Wiki documents. | |
.Parameter SourceScriptFolder | |
Source folder where the scripts are located |
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
#A hashtable converted into a json string can be converted back to hashtable like so: | |
#Create a hashtable, convert to json | |
$hash = @{"Name1"="Value";"Name2"="Value2"} | |
$json = $hash | ConvertTo-Json | |
#Take the json string and convert it back: | |
$newobject = $json | ConvertFrom-Json | |
$newhash = @{} | |
foreach ($prop in $newobject.psobject.Properties) |
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
cmd://"C:\Windows\System32\cmd.exe" /c cmdkey.exe /generic:TERMSRV/{S:SERVER} /user:{S:DOMAIN}{USERNAME} /pass:{PASSWORD} & mstsc.exe /v:{S:SERVER} & cmdkey.exe /delete:TERMSRV/{S:SERVER} |
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
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory=$true)] | |
[string] | |
$ComputerName, | |
[int] | |
$Port = 443 | |
) |
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
<# | |
.EXAMPLE | |
Select-NamespacedXml -XPath //def:SomeElement -XmlDocument $XmlDoc -DefaultNamespacePrefix def | |
.EXAMPLE | |
Select-NamespacedXml -XPath //foo:AFooElement -XmlDocument $XmlDoc | |
Assuming the document looks like this: | |
<Root xmlns="http://namespaces/vanilla" xmlns:foo="http://namespaces/foo"> | |
<foo:AFooElement>Hello</foo:AFooElement> |
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
#requires -version 2.0 | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory=$true)] | |
[string] | |
$ComputerName, | |
[Parameter(Mandatory=$true)] | |
[string] |