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
$user32 = Add-Type -Name 'user32' -Namespace 'Win32' -PassThru -MemberDefinition @' | |
[DllImport("user32.dll")] | |
public static extern int GetWindowLong(IntPtr hWnd, int nIndex); | |
[DllImport("user32.dll")] | |
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); | |
[DllImport("user32.dll", SetLastError = true)] | |
public static extern bool SetLayeredWindowAttributes(IntPtr hWnd, uint crKey, int bAlpha, uint dwFlags); |
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
$Port = "8080" | |
netstat -a -n -o | where { $_ -match $Port } | foreach { | |
$Process = Get-Process -PID (($_ -replace "\s+"," ") -split " ")[-1] | |
"Process: $($Process.ProcessName) ($($Process.Id)) is using $Port" | |
} |
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
<div class="playingCards fourColours faceImages"> | |
<div class="card rank-7 spades"> | |
<span class="rank"></span> | |
<span class="suit"></span> | |
</div> | |
</div> | |
<div class="playingCards faceImages"> | |
<div class="card rank-7 diams"> | |
<span class="rank"></span> |
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
<# | |
.SYNOPSIS | |
Get some filler text that is dad jokes | |
.PARAMETER minLength | |
The minimum length of text you need | |
PS> Get-DadJokeIpsum -minLength 500 | |
Where did Captain Hook get his hook? From a second hand store. Why was the broom late for the meeting? He overswept. Dad, can you put my shoes on? I don't think they'll fit me. For Valentine's day, I decided to get my wife some beads for an abacus. It's the little things that count. Why is the ocean always blue? Because the shore never waves back. How does a dyslexic poet write? Inverse. Whiteboards ... are remarkable. Want to hear a joke about construction? Nah, I'm still working on it. Why do scuba divers fall backwards into the water? Because if they fell forwards theyâd still be in the boat. Some people say that comedians who tell one too many light bulb jokes soon burn out, but they don't know watt they are talking about. They're not that bright. Don't trust atoms. They make up everything. I am terrified of elevators. Iâm going to start taking steps to |
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
$UserCredential = Get-Credential | |
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection | |
Import-PSSession $Session | |
Connect-MsolService -credential $UserCredential | |
$ReportPath = "C:\filename"+ (Get-Date -UFormat %D).Replace("/",".") +".csv" | |
$Report = @() |
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
$FilePaths = @() | |
$FilePaths = (Get-WmiObject win32_process -filter "name like 'notepad.exe'") | | |
foreach { ($_.commandline -split " ",2)[1] } | |
if($FilePaths.count -gt 1) { | |
$FilePath = $FilePaths | Out-GridView -PassThru -Title "Select the open file you would like to search" | |
} else { | |
$FilePath = $FilePaths | |
} |
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
$Port = "8080" | |
netstat -a -n -o | where { $_ -match $Port } | foreach { | |
$Process = Get-Process -PID (($_ -replace "\s+"," ") -split " ")[-1] | |
"Process: $($Process.ProcessName) ($($Process.Id)) is using $Port" | |
} |
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
<# | |
.SYNOPSIS | |
Copy files using your clipboard and PowerShell | |
.DESCRIPTION | |
The file specified at $Path is converted to a base64 string, wrapped with a tiny script that converts the base64 string | |
back to binary and saves it at the path specified in the $Destination parameter | |
#> | |
function Copy-PasteItem { | |
[CmdletBinding()] |
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 Show-Diff { | |
param([String[]]$OldString,[String[]]$NewString) | |
$WebPage = @" | |
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
NewerOlder