Skip to content

Instantly share code, notes, and snippets.

View KurtDeGreeff's full-sized avatar

Kurt De Greeff KurtDeGreeff

View GitHub Profile
@jpoehls
jpoehls / encoding-helpers.ps1
Created April 17, 2012 14:54
Convert-FileEncoding and Get-FileEncoding
<#
.SYNOPSIS
Converts files to the given encoding.
Matches the include pattern recursively under the given path.
.EXAMPLE
Convert-FileEncoding -Include *.js -Path scripts -Encoding UTF8
#>
function Convert-FileEncoding([string]$Include, [string]$Path, [string]$Encoding='UTF8') {
$count = 0
@gravejester
gravejester / Trace-Route.ps1
Last active April 3, 2018 16:26
For some reason I wanted to write a trace route script in PowerShell, but decided to run it through Google first to see if it had been done. Surprisingly few results came up, and as far as I can tell, only one true PowerShell script doing Trace Route without just being a wrapper for tracert or something similar: https://snoj.us/75/traceroute-wit…
function Trace-Route {
<#
.SYNOPSIS
Trace the route between source computer and a target machine.
.DESCRIPTION
Trace the route between source computer and a target machine.
.EXAMPLE
Trace-Route Computer01
Perform trace route to Computer01
.EXAMPLE
@altrive
altrive / Test-RebootRequired.ps1
Last active August 3, 2023 14:34
Check pending reboot on local computer
#Based on <http://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542>
function Test-RebootRequired
{
$result = @{
CBSRebootPending =$false
WindowsUpdateRebootRequired = $false
FileRenamePending = $false
SCCMRebootPending = $false
}
@19WAS85
19WAS85 / powershell-web-server.ps1
Last active July 17, 2025 16:44
A simple web server built with powershell.
# This is a super **SIMPLE** example of how to create a very basic powershell webserver
# 2019-05-18 UPDATE — Created by me and and evalued by @jakobii and the comunity.
# Http Server
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
$http.Prefixes.Add("http://localhost:8080/")
# Start the Http Server
@HowardvanRooijen
HowardvanRooijen / gist:5498260
Last active October 19, 2016 07:17
Sample showing how you can use splatting to create a DSL for config data to drive a script
# This is the public script we call as an entry point into the deployment / configuration process
Function Invoke-Deployment
{
Param
(
$ApplicationPool,
$WebSite
)
Invoke-AppPoolTasks @PSBoundParameters
@janegilring
janegilring / 2013SGEvent5AdvancedSample.ps1
Created May 28, 2013 18:45
Entry from the 2013 Scripting Games Advanced Event 5, reviewed at blog.powershell.no
<#
.Synopsis
   Gets client IP collection from IIS logs
.DESCRIPTION
   Extracts the Client IP addresses from IIS logs, and returns the unique addresses
   found.  Optionally, it will include counts of how many times each address appeared
   in the logs, by enabling the -Count switch. If -Count is enabled you can return either
   a collection of PS objects having ClientIP and Count properties, or a hash table of the
   ip addresses and counts by using the -AsHash switch.
.PARAMETER Path
@janegilring
janegilring / Get-PrinterDriver.ps1
Last active September 22, 2023 07:39
Demonstration on how to convert the DriverVersion property of Get-PrinterDriver in a readable format.
Get-PrinterDriver | Select-Object Name,@{
n="DriverVersion";e={
$ver = $_.DriverVersion
$rev = $ver -band 0xffff
$build = ($ver -shr 16) -band 0xffff
$minor = ($ver -shr 32) -band 0xffff
$major = ($ver -shr 48) -band 0xffff
"$major.$minor.$build.$rev"
@kabronkline
kabronkline / gist:6581453
Created September 16, 2013 14:30
PowerShell SVN Checkout / Export
# SVN Export Script
#
# Given an SVN URL and local directory path, this script copies all files from
# SVN into the specified local directory.
#
# Uses SharpSVN DLL v1.7002.1998 (Documentation : http://docs.sharpsvn.net/current/)
#
# Takes two command line arguments, an SVN URL and a local directory path.
param ([string]$svnUrl = $(read-host "Please specify the path to SVN"),
[string]$svnLocalPath = $(read-host "Please specify the local path"),
Get-ChildItem Cert:\LocalMachine\Root | Where-Object {$_.Subject -eq 'CN=SubjectName'} | Foreach-Object { [system.IO.file]::WriteAllBytes("C:\SSL\SubjectName.pfx",($_.Export('PFX', 'p@ssw0rd')) ) }
#Requires -Version 3.0
#Requires -Module DnsClient,ActiveDirectory
<#
.SYNOPSIS
Practice Event of Powershell Winter Scripting 2014
.DESCRIPTION
Practice Event of Powershell Winter Scripting 2014