Skip to content

Instantly share code, notes, and snippets.

View FriedrichWeinmann's full-sized avatar

Friedrich Weinmann FriedrichWeinmann

View GitHub Profile
@FriedrichWeinmann
FriedrichWeinmann / Connect-DeviceCode.ps1
Created April 5, 2022 10:37
Custom Connect to azure AD using the DeviceCode flow
function Connect-DeviceCode {
<#
.SYNOPSIS
Connects to Azure AD using the Device Code authentication workflow.
.DESCRIPTION
Connects to Azure AD using the Device Code authentication workflow.
.PARAMETER ClientID
The ID of the registered app used with this authentication request.
@FriedrichWeinmann
FriedrichWeinmann / Test-ClmCompatibility.ps1
Last active November 17, 2021 18:18
Tests, whether the targeted file would have trouble executing under Constrained Language Mode.
function Test-ClmCompatibility {
<#
.SYNOPSIS
Tests, whether the targeted file would have trouble executing under Constrained Language Mode.
.DESCRIPTION
Tests, whether the targeted file would have trouble executing under Constrained Language Mode (CLM).
In CLM, various language features and commands are constrained in their ability to execute.
This command uses the AST parser to scan for as many known issues as possible and gives a comprehensive report for concerns found.
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.