Skip to content

Instantly share code, notes, and snippets.

View FriedrichWeinmann's full-sized avatar

Friedrich Weinmann FriedrichWeinmann

View GitHub Profile
function Read-Hashtable {
<#
.Synopsis
Reads a hash table and returns its contents as key/value objects.
.DESCRIPTION
Reads a hash table and returns its contents as a hierarchical structure.
Use the AsHashtable switch to return the result as a flat hashtable, rather than one object per.
.PARAMETER Hashtable
@FriedrichWeinmann
FriedrichWeinmann / speakerconfig.ps1
Created March 1, 2023 11:21
Tools to update speaker settings on windows
#
function Disable-Privilege {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[ValidateSet('SeAssignPrimaryTokenPrivilege','SeAuditPrivilege','SeBackupPrivilege','SeChangeNotifyPrivilege','SeCreateGlobalPrivilege','SeCreatePagefilePrivilege','SeCreatePermanentPrivilege','SeCreateSymbolicLinkPrivilege','SeCreateTokenPrivilege','SeDebugPrivilege','SeDelegateSessionUserImpersonatePrivilege','SeEnableDelegationPrivilege','SeImpersonatePrivilege','SeIncreaseBasePriorityPrivilege','SeIncreaseQuotaPrivilege','SeIncreaseWorkingSetPrivilege','SeLoadDriverPrivilege','SeLockMemoryPrivilege','SeMachineAccountPrivilege','SeManageVolumePrivilege','SeProfileSingleProcessPrivilege','SeRelabelPrivilege','SeRemoteShutdownPrivilege','SeRestorePrivilege','SeSecurityPrivilege','SeShutdownPrivilege','SeSyncAgentPrivilege','SeSystemEnvironmentPrivilege','SeSystemProfilePrivilege','SeSystemtimePrivilege','SeTakeOwnershipPrivilege','SeTcbPrivilege','SeTimeZonePrivilege','SeTrustedCredManAccessPrivilege','SeUndockPrivi
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 October 24, 2024 16:27
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.