Skip to content

Instantly share code, notes, and snippets.

View FriedrichWeinmann's full-sized avatar

Friedrich Weinmann FriedrichWeinmann

View GitHub Profile
function Grant-FSPermission {
<#
.SYNOPSIS
Helper tool to simplify file system permission assignments.
.DESCRIPTION
Helper tool to simplify file system permission assignments.
Allows bulk-updating / assigning permissions.
.PARAMETER Identity
function Write-EventLogEntry
{
<#
.SYNOPSIS
Write an eventlog entry
.DESCRIPTION
Write an eventlog entry
.PARAMETER LogName
function New-Password
{
<#
.SYNOPSIS
Generate a new, complex password.
.DESCRIPTION
Generate a new, complex password.
.PARAMETER Length
function Test-PrintNightmareVulnerability {
<#
.SYNOPSIS
Tests whether the target system is vulnerable to the PrintNightmare vulnerability.
.DESCRIPTION
Tests whether the target system is vulnerable to the PrintNightmare vulnerability.
Uses PowerShell remoting.
This checks whether vulnerable GPO/registry settings are applied.
function Show-SaveFileDialog {
[CmdletBinding()]
param (
[string]
$InitialDirectory = '.',
[string]
$Filter = '*.*',
$Filename
function Show-OpenFileDialog {
<#
.SYNOPSIS
Show an Open File dialog using WinForms.
.DESCRIPTION
Show an Open File dialog using WinForms.
.PARAMETER InitialDirectory
The initial directory from which the user gets to pick a file.
@FriedrichWeinmann
FriedrichWeinmann / Get-UserInput.ps1
Created May 25, 2021 08:48
Get userinput and validate it
function Get-UserInput {
<#
.SYNOPSIS
Asks for user input, then validates response.
.DESCRIPTION
Asks for user input, then validates response.
.PARAMETER Prompt
The message to show to the user as input prompt.
function Test-TlsProtocol {
<#
.SYNOPSIS
A quick helper function to test supported TLS protocols
.DESCRIPTION
A quick helper function to test supported TLS protocols
.PARAMETER ComputerName
The hosts to check.
<#
Sample snippet to interact with the NTDS certificate store using windows APIs
#>
$source = @'
using System;
using System.Runtime.InteropServices;
public static class StoreHelper
{
[DllImport("CRYPT32.DLL", EntryPoint="CertOpenStore", CharSet=CharSet.Auto, SetLastError=true)]
@FriedrichWeinmann
FriedrichWeinmann / Start-Script.ps1
Created June 22, 2020 06:06
Launches a target script in a new process, passing through all parameters.
function Start-Script {
<#
.SYNOPSIS
Launches a target script in a new process, passing through all parameters.
.DESCRIPTION
Launches a target script in a new process, passing through all parameters.
Uses dynamic parameters to offer the same signature as the script itself.
Uses the same powershell hosting application that executes Start-Script to start the new process.