Skip to content

Instantly share code, notes, and snippets.

View SirHenryIII's full-sized avatar

Philip Stone SirHenryIII

View GitHub Profile
@SirHenryIII
SirHenryIII / sysprep.ps1
Created September 22, 2023 06:51
Sysprep command
Start-Process -FilePath "C:\Windows\System32\Sysprep\Sysprep.exe" -ArgumentList "/oobe /generalize /shutdown /mode:vm /quiet"
--- Get-WindowsAutoPilotInfo.ps1 2020-09-21 17:42:58.000000000 +0200
+++ Get-WindowsAutoPilotInfo_new.ps1 2021-08-04 08:58:09.417595000 +0200
@@ -410,11 +410,24 @@
}
}
+ $deviceUpdateParameter = @{}
+
# Assign the computer name
if ($AssignedComputerName -ne "")
@SirHenryIII
SirHenryIII / MyParadox.psm1
Last active March 8, 2020 10:01
My own extension for oh-my-posh Paradox Theme. It allows me to show extensions that I previous loaded to know what is loaded in which Panel/Window
#requires -Version 2 -Modules posh-git
function Write-Theme {
param(
[bool]
$lastCommandFailed,
[string]
$with
)
@SirHenryIII
SirHenryIII / Remove-InactiveUsersFromGroups.ps1
Created January 15, 2018 16:58
Remove Inactive ADUsers from ADGroups
$IgnoreUser = Get-Content ~\Downloads\user.txt
$InactiveUsers = Get-ADUser -Filter * -Properties memberof | ?{$_.Enabled -eq $false -and $IgnoreUser -notcontains $_.samaccountname}
$IgnoreGroups = Get-Content ~\Downloads\groups.txt
$includeGroups = Get-Content ~\Downloads\groups2.txt
foreach($user in $InactiveUsers){
$user.MemberOf | Get-ADGroup | ?{$IncludeGroups -contains $_.Name -and $IgnoreGroups -notcontains $_.Name} #| %{$_ | Remove-ADGroupMember -Members $user.SamAccountName -Confirm:$false}
}