Skip to content

Instantly share code, notes, and snippets.

View IISResetMe's full-sized avatar

Mathias R. Jessen IISResetMe

  • Booking.com
  • Netherlands
View GitHub Profile
@IISResetMe
IISResetMe / Scan-LOLDrivers.ps1
Created May 19, 2023 17:08 — forked from MHaggis/Scan-LOLDrivers.ps1
it works - but use with caution :) it's a bit noisy and I think it's broken
function Scan-LOLDrivers {
param(
[Parameter(Mandatory = $true)]
[string]$path
)
Add-Type -TypeDefinition @"
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
function Get-AvailableLicenseTemplates {
[CmdletBinding()]
param ()
process {
Write-Host "`$PSScriptRoot:" $PSScriptRoot -ForegroundColor Green
# Define the parent directory containing the folders
$ParentDirectory = "$PSScriptRoot\..\Templates\LICENSE\"
# Get the list of folders
$Folders = Get-ChildItem -Path $ParentDirectory -Directory
@IISResetMe
IISResetMe / FullPathHashtable.ps1
Last active January 21, 2025 15:34 — forked from HCRitter/FullPathHashtable.ps1
This PowerShell script creates a hierarchical list of objects with DisplayName, ID, and ParentID properties, organized into three levels. It also builds a HashTable to store these objects and calculates a FullPath property for each object by recursively resolving the hierarchy using the ParentID. The FullPath represents the hierarchical path fro…
# Define the list of objects
$objects = @(
# Level 1
[PSCustomObject]@{ DisplayName = "Root1"; ID = 1; ParentID = $null }
[PSCustomObject]@{ DisplayName = "Root2"; ID = 2; ParentID = $null }
# Level 2
[PSCustomObject]@{ DisplayName = "Child1.1"; ID = 3; ParentID = 1 }
[PSCustomObject]@{ DisplayName = "Child1.2"; ID = 4; ParentID = 1 }
$array = 1..10
for ($i = 0; $i -lt $array.length; $i++) {
Write-Host "Loop #$($array[$i])"
if ($i = $array.length) { Write-Host "Last loop!" }
}
$array = 1..10
for ($i = 0; $i -lt $array.Length; $i++) {
Write-Host "Loop iteration $($i + 1): #$($array[$i])"
if ($i -eq $array.Length - 1) { Write-Host "Last loop!" }
}