Skip to content

Instantly share code, notes, and snippets.

Avatar

Micah Rairdon Tiberriver256

View GitHub Profile
@Tiberriver256
Tiberriver256 / PowerShellNTFSStaticFileServer.ps1
Last active Aug 13, 2022
This script starts a small web server listening on localhost:8080 that will impersonate the authenticated user and serve static content. This means if they do not have NTFS permissions to the file they will get an access denied or a 404 file not found if they do not have NTFS access to list contents of the directory.
View PowerShellNTFSStaticFileServer.ps1
function Get-DirectoryContent {
<#
.SYNOPSIS
Function to get directory content
.EXAMPLE
Get-DirectoryContent -Path "C:\" -HeaderName "poshserver.net" -RequestURL "http://poshserver.net" -SubfolderName "/"
@Tiberriver256
Tiberriver256 / PSWebServer.psm1
Last active Aug 3, 2022
Sample of making a simple webserver in PowerShell. If you have more complex needs checkout Pode (https://github.com/Badgerati/Pode) as a fully fledged PowerShell web server.
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.
@Tiberriver256
Tiberriver256 / boxstarter
Last active Jul 13, 2022
My personal development environment configuration
View boxstarter
# Configure Windows
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Update-ExecutionPolicy Unrestricted
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name Get-ChildItemColor, oh-my-posh -Force
## Git
cinst -y git.install
@Tiberriver256
Tiberriver256 / LicenseSKUToNameMappingHash.ps1
Last active May 3, 2022
LicenseSKUToNameMapping HashTable
View LicenseSKUToNameMappingHash.ps1
$LicenseSKUToNameMapping = @{
'SHAREPOINTENTERPRISE_MIDMARKET' = 'SharePoint Online (Plan 1)'
'ESKLESSWOFFPACK_GOV' = 'Microsoft Office 365 (Plan K2) for Government'
'AAD_BASIC' = 'Azure Active Directory Basic'
'AAD_BASIC_AAD_BASIC' = 'Azure AD Basic - Azure Active Directory Basic'
'AAD_BASIC_EDU' = 'Azure Active Directory Basic for EDU'
'AAD_EDU' = 'Azure Active Directory for Education'
'AAD_PREMIUM' = 'Azure Active Directory Premium P1'
'AAD_PREMIUM_AAD_PREMIUM' = 'Azure AD Premium P1 - Azure AD Premium P1'
'AAD_PREMIUM
@Tiberriver256
Tiberriver256 / Get-AzureDevOpsAgentSpecifications.ps1
Last active Oct 16, 2021
Used to generate a report of Azure DevOps agent specifications to determine which classic build/release definitions are using different operating systems
View Get-AzureDevOpsAgentSpecifications.ps1
Import-Module VSTeam
function Get-AzureDevOpsAgentSpecifications {
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[string]
$Account,
View Get-DadJokeIpsum.ps1
<#
.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
View Show-HTML
function Show-HTML ([string]$HTML)
{
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
[xml]$XAML = @'
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="PowerShell HTML GUI" WindowStartupLocation="CenterScreen">
<WebBrowser Name="WebBrowser"></WebBrowser>
View ObjectForScripting
function new-PowershellWebGUI ($HTMLRaw,$Title,$Runspace) {
[xml]$xaml = @"
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="$Title" Height="500" Width="700">
<Grid>
<DockPanel>
<WebBrowser Name="WebBrowser" DockPanel.Dock="Top" Margin="30">
</WebBrowser>
@Tiberriver256
Tiberriver256 / lilPowerShellNotepadSearcher.ps1
Last active Feb 24, 2021
This is a tiny little PowerShell script that will find any files you have open in Notepad and present them in out-gridview with lines to help with searching. Large files it will prompt you for a pre-search term or a regex to make it usable in out-gridview. Super handy for when you get logs in Outlook and don't want to save them to somewhere spec…
View lilPowerShellNotepadSearcher.ps1
$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
}
View Set-Transparency.ps1
$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);