Skip to content

Instantly share code, notes, and snippets.

View rysstad's full-sized avatar

Tor Arne Rysstad rysstad

View GitHub Profile
@nohwnd
nohwnd / Uninstall-Pester.ps1
Last active July 5, 2024 03:59
Remove built-in version of Pester 3 (or -All) from Windows 10 Program Files and Program Files (x86).
#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) {
@MichaelPote
MichaelPote / himawari.ps1
Created February 3, 2016 19:11
Windows Powershell Script to download the latest image from the Himawari-8 satelite, combine the tiles into a single image, convert to jpg and then set as the desktop background.
#
# 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
#
function Test-NetPort {
[CmdletBinding()]
[OutputType([Boolean])]
param (
[Parameter(Mandatory,
ValueFromPipeline,
ValueFromPipelineByPropertyName)]
[String] $ComputerName,
[Parameter(Mandatory,
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
#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)
@janikvonrotz
janikvonrotz / ConnectRemoteDesktopusingKeePassCredentials
Created November 13, 2013 13:46
Connect Remote Desktop using KeePass Credentials #KeePass #EmbededPost
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}
@jstangroome
jstangroome / Get-RemoteSSLCertificate.ps1
Last active June 12, 2024 16:09
PowerShell script to retrieve the public X509 certificate from a remote TLS endpoint
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[string]
$ComputerName,
[int]
$Port = 443
)
@jstangroome
jstangroome / Select-NamespacedXml.ps1
Created April 12, 2012 05:56
An alternate version of another gist ( https://gist.github.com/2363747 ) but to be used with PowerShell's Select-Xml instead
<#
.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>
@jstangroome
jstangroome / Send-RemotingFile.ps1
Created January 22, 2011 13:04
Transfers a single file to another machine via the PowerShell Remoting protocol
#requires -version 2.0
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[string]
$ComputerName,
[Parameter(Mandatory=$true)]
[string]