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 New-PSWebServer { | |
<# | |
.Synopsis | |
Creates a web server that will invoke PowerShell code based on routes being asked for by the client. | |
.Description | |
New-PSWebServer creates a web server. The web server is composed of a schema that defines the client's requests to routes where PowerShell code is executed. | |
Under the covers, New-PSWebServer uses the HTTPListener .NET class to execute powershell code as requested, retrieves the results and sends data back through the httplistener web server framework. |
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
using System; | |
using System.Web; | |
using System.Text.RegularExpressions; | |
namespace HttpModules | |
{ | |
/// <summary> | |
/// This module handles complications from our load balancer configuration not properly passing the client's true IP | |
/// address to our code via the REMOTE_ADDR and REMOTE_HOST variables. We tried to use URL Rewrite to compensate for | |
/// this, but it does not run when default documents are being accessed (a longstanding bug). |
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
# PowerShell version of the original I found https://pastebin.com/cX6nupy4 | |
foreach ($Package in (Get-ChildItem C:\WINDOWS\servicing\Packages\*Hyper-V*.mum).FullName) { | |
dism /online /norestart /add-package:$Package | |
} | |
dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /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
# Original form stackoverflow, can find the uri, answer by mklement0 | |
$start = Get-Date | |
$queue = [System.Collections.Concurrent.ConcurrentQueue[string]]::new() | |
$job = Start-ThreadJob { | |
$queue = $using:queue | |
$item = $null | |
while ($true) { | |
while ($queue.TryDequeue([ref] $item)) { | |
if ("`0" -eq $item) { 'Quitting...'; return } |