Skip to content

Instantly share code, notes, and snippets.

View FriedrichWeinmann's full-sized avatar

Friedrich Weinmann FriedrichWeinmann

View GitHub Profile
function Get-GpoBackupName {
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[Alias('FullName')]
[string]
$Path
)
process {
foreach ($folder in $Path) {
@FriedrichWeinmann
FriedrichWeinmann / Get-TrustRecursive.ps1
Created February 10, 2023 15:27
Generates a configuration map of all trusts in all directions, recursively following all trust links.
function ConvertTo-TrustObject {
<#
.SYNOPSIS
Converts an AD Object for a trust object and parses it into humanly useful information.
.DESCRIPTION
Converts an AD Object for a trust object and parses it into humanly useful information.
This includes encryption settings and parsing the numeric values of the trust attributes.
.PARAMETER Trust
@FriedrichWeinmann
FriedrichWeinmann / Invoke-SystemCommand.ps1
Created January 24, 2023 16:54
Execute a scriptblock as SYSTEM by setting up a temporary scheduled task.
function Invoke-SystemCommand {
<#
.SYNOPSIS
Execute a scriptblock as SYSTEM by setting up a temporary scheduled task.
.DESCRIPTION
Execute a scriptblock as SYSTEM by setting up a temporary scheduled task.
.PARAMETER Name
The name of the task
@FriedrichWeinmann
FriedrichWeinmann / module-signing.ps1
Last active February 17, 2023 14:35
A script to transfer modules from one repository to another while codesigning them.
<#
.SYNOPSIS
A script to transfer modules from one repository to another while codesigning them.
.DESCRIPTION
Script intended for use in a code-signing pipeline:
It will scan source and destination repository and for each missing (or lower version) module will:
- Download the module from the source repository
- Sign all code from that module with the specified certificate retrieved from certificate store.
- Publish the module to the destination store
@FriedrichWeinmann
FriedrichWeinmann / DomainCryptographyScan.ps1
Last active May 30, 2023 05:15
Scans an Active Directory domain's and its principal's kerberos encryption configuration.
<#
.SYNOPSIS
Scans an Active Directory domain's and its principal's kerberos encryption configuration.
.DESCRIPTION
Scans an Active Directory domain's and its principal's kerberos encryption configuration.
It will generate all data via LDAP, and analyze the results for possible authentication issues.
It supports three ways to report:
- Print: Write analysis of results to screen
function Get-LdapObject {
<#
.SYNOPSIS
Use LDAP to search in Active Directory
.DESCRIPTION
Utilizes LDAP to perform swift and efficient LDAP Queries.
.PARAMETER LdapFilter
@FriedrichWeinmann
FriedrichWeinmann / Get-ServiceAccess.ps1
Created October 16, 2022 07:46
Returns windows service security information from registry
function Get-ServiceAccess {
<#
.SYNOPSIS
Returns windows service security information from registry
.DESCRIPTION
Returns windows service security information from registry.
This allows finding services that have been hidden from SCM through a deny rule.
Triggered by this thread on Twitter:
@FriedrichWeinmann
FriedrichWeinmann / Connect-ClientSecret.ps1
Created April 5, 2022 11:46
Connect to AzureAD using a client secret
function Connect-ClientSecret {
<#
.SYNOPSIS
Connects to AzureAD using a client secret.
.DESCRIPTION
Connects to AzureAD using a client secret.
.PARAMETER ClientID
The ID of the registered app used with this authentication request.
@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.