Skip to content

Instantly share code, notes, and snippets.

function Start-psWebRequestServer {
[CmdletBinding()]
param ()
begin {
# default
###########
$ServerPort = 5678
$HostNameOrIP = "*"
$SingleRequest = $False
@ChrisStro
ChrisStro / Start-psHTTPServer.ps1
Last active June 19, 2022 20:52
Simple function to start short running powershell "webserver" ; I mainly use it for Cloud-Init files
function Start-psHTTPServer {
[CmdletBinding()]
param (
[Parameter(Mandatory = $False, Position = 0, HelpMessage = 'Enter a port for the HTTP Server to listen on. Valid ports are between 1 and 65535. Example: 1234')]
[ValidateRange(1, 65535)][int32]$Port = 8081,
[Parameter(Mandatory = $False, Position = 1, HelpMessage = 'Enter hostname or ip for listener')]
[string]$HostNameOrIP = "*",
[Parameter(Mandatory = $False, Position = 2, HelpMessage = 'End listener after single request')]
@ChrisStro
ChrisStro / New-psRunspace.ps1
Created June 28, 2021 13:01
Function to start "throw away" runspaces and callbacks
<#
.SYNOPSIS
Start scriptblock in background runspace, which will disposed when finished
.DESCRIPTION
Start scriptblock in background runspace, which will disposed when finished
.PARAMETER SetVariable
Variables to be parsed in runspace
@ChrisStro
ChrisStro / Get-FileFromWeb.ps1
Last active March 21, 2024 15:43
Get-FileFromWeb | Function to show download progress in powershell
function Get-FileFromWeb {
param (
# Parameter help description
[Parameter(Mandatory)]
[string]$URL,
# Parameter help description
[Parameter(Mandatory)]
[string]$File
)