Skip to content

Instantly share code, notes, and snippets.

View thisislukasbenz's full-sized avatar

Lukas Benz thisislukasbenz

View GitHub Profile
@thisislukasbenz
thisislukasbenz / Get-LogonSessionData.ps1
Created March 16, 2025 19:31 — forked from jborean93/Get-LogonSessionData.ps1
Get LSA logon session data
# Copyright: (c) 2022, Jordan Borean (@jborean93) <[email protected]>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Get-LogonSessionData {
<#
.SYNOPSIS
Get LSA logon session data.
.DESCRIPTION
Get the logon session information for all or a specific logon session or specific process logon sessions.
@thisislukasbenz
thisislukasbenz / Appx-Server2025.ps1
Created March 16, 2025 19:13 — forked from jborean93/Appx-Server2025.ps1
Fix Appx in PSRemoting for Server 2025
# Server 2025 fails to run Get-AppxPackage and other DISM module commands in
# a PSRemoting (psrp) session as it has a dependency on some dll's not present
# in the GAC and only in the powershell.exe directory. As PSRP runs through
# wsmprovhost.exe, it fails to find those dlls. This hack will manually load
# the 4 required dlls into the GAC. This is a hack and should be removed in the
# future if MS fix their bug on 2025.
Add-Type -AssemblyName "System.EnterpriseServices"
$publish = [System.EnterpriseServices.Internal.Publish]::new()
@thisislukasbenz
thisislukasbenz / Get-WindowsEdition.ps1
Last active November 11, 2024 10:45
Get-WindowsVersion
#[CmdletBinding()]
Param
(
[Parameter(Mandatory=$false,
ValueFromPipelineByPropertyName=$true,
ValueFromPipeline=$true
)]
[string[]]$ComputerName = $env:COMPUTERNAME
)
@thisislukasbenz
thisislukasbenz / Script-Template-WithCreds.ps1
Created May 23, 2024 07:00 — forked from davefunkel/Script-Template-WithCreds.ps1
PowerShell Script Template with Saved Creds
<#
.SYNOPSIS
The synopsis goes here. This can be one line, or many.
This version of the template has inbuilt functions to capture credentials and store it securely for reuse
Avoids the need to have plaintext passwords in the script
.DESCRIPTION
The description is usually a longer, more detailed explanation of what the script or function does.
Take as many lines as you need.