Skip to content

Instantly share code, notes, and snippets.

@bentman
bentman / Add-DevToMyWinServer.ps1
Last active October 30, 2024 12:03
Install Dev Tools on Win Server 2022
<#
.SYNOPSIS
Script to install Dev Tools on Windows Server (tested on 2022)
.DESCRIPTION
Installs the following from multiple resources:
Microsoft.VCLibs v14.00 (github)
Microsoft.UI v2.8.6 (github)
winget-cli (dynamic version retrieval from api.github.com)
Microsoft.WindowsTerminal (dynamic version retrieval from api.github.com)
Microsoft pwsh.exe vCurrent (winget)
function Wait-TranscriptEnd {
<##
.SYNOPSIS
Waits for the creation and completion of a PowerShell transcript file (helpful in race conditions).
.DESCRIPTION
This function polls for the existence of a transcript file and then monitors its content until a specific end pattern is detected.
.PARAMETER transcriptPath
The path to the transcript file. Required.
.PARAMETER pollSeconds
The polling interval in seconds. Default is 10 seconds.
function Wait-UntilAdComputerDeleted {
<#
.SYNOPSIS
Waits until a specified computer object is deleted from all domain controllers.
.DESCRIPTION
This function checks the deletion status of a specified computer object across all discovered domain controllers. It waits until the object is confirmed deleted on all domain controllers or identifies any inaccessible controllers after a specified number of failures.
.PARAMETER computerName
The name of the computer object to check for deletion. Required.
.PARAMETER sleepInterval
The number of seconds to wait between checks. Default is 5 seconds.
<#
.SYNOPSIS
PowerShell script using ChatGPT API for interview preparation.
.DESCRIPTION
Collects user inputs (job title, industry, resume, company name, interviewer details)
and generates interview topics, skills, questions, answers, and more using the ChatGPT API.
.INPUTS
Job Title
Industry
Resume
@bentman
bentman / Test-CPUFeature.ps1
Created August 22, 2024 16:08
Will my PC run w11-24h2?... oh no! my Surface Go v1.0 will not be because of POPCNT - so I put Linux on it! https://github.com/linux-surface/linux-surface
function Test-CPUFeature {
param (
[Parameter(Mandatory=$true)]
[ValidateSet("SSE4.2", "SSE4A")]
[string]$Feature
)
$signature = @"
[DllImport("kernel32.dll")]
public static extern IntPtr GetCurrentProcess();