Skip to content

Instantly share code, notes, and snippets.

View Enable-Hyper-V-Win10-Home.ps1
# 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
@affieuk
affieuk / ClientIP.cs
Created Jan 5, 2018 — forked from winzig/ClientIP.cs
If you're using a load balancer that obscures the remote client's true IP address, you can run this IHttpModule to take the first IP address from the X-Forwarded-For header, and overwrite the REMOTE_ADDR and REMOTE_HOST server variables. (We tried to use the URL Rewrite module that everyone normally recommends to do this, but it's buggy.)
View ClientIP.cs
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).
View PSWebServer.psm1
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.