Skip to content

Instantly share code, notes, and snippets.

@adamgell
adamgell / gist:09d394d90c140207931bd3de19122eff
Last active July 12, 2023 17:12
Dump User last password set
Get-ADUser -Filter * -Properties Name,PwdLastSet,PasswordLastSet | sort Name | Select Name,@{Name='PwdLastSet';Expression={[DateTime]::FromFileTime($_.PwdLastSet)}},PasswordLastSet | Export-Csv C:\Temp\Output.csv -NoTypeInformation
<#
.SYNOPSIS
Test the pending reboot status on a local and/or remote computer.
.DESCRIPTION
This function will query the registry on a local and/or remote computer and determine if the
system is pending a reboot, from Microsoft/Windows updates, Configuration Manager Client SDK, Pending
Computer Rename, Domain Join, Pending File Rename Operations and Component Based Servicing.
ComponentBasedServicing = Component Based Servicing
function New-VMBIOSGUID
{
<#
.SYNOPSIS
Changes the BIOSGUID for Hyper-V guests running on Hyper-V versions 8/2012 or later.
.DESCRIPTION
Changes the BIOSGUID for Hyper-V guests running on Hyper-V versions 8/2012 or later.
A GUID can be supplied. If not, one is automatically generated.
If the virtual machine is running, this script will attempt to shut it down prior to the operation. Once the replacement is complete, the virtual machine will be turned back on.
.PARAMETER VM
@adamgell
adamgell / FixIntuneEnrollment.ps1
Last active May 2, 2023 14:23
Fix intune enrollment
<#PSScriptInfo
.VERSION 0.11
.GUID 715a6707-796c-445f-9e8a-8a0fffd778a4
.AUTHOR Rudy Ooms
.COMPANYNAME
.COPYRIGHT
.TAGS Windows, AutoPilot, Powershell
.LICENSEURI
.PROJECTURI https://www.github.com
.ICONURI
@adamgell
adamgell / server2019.md
Created October 30, 2018 01:37
Windows Server 2019 download and DISM
@adamgell
adamgell / README.md
Created August 31, 2018 13:26 — forked from magnetikonline/README.md
Enable LDAP over SSL (LDAPS) for Microsoft Active Directory servers.

Enable LDAP over SSL (LDAPS) for Microsoft Active Directory servers

By default Microsoft active directory servers will offer LDAP connections over unencrypted connections (boo!).

The steps below will create a new self signed certificate appropriate for use with and thus enabling LDAPS for an AD server. Of course the "self-signed" portion of this guide can be swapped out with a real vendor purchased certificate if required.

Steps have been tested successfully with Windows Server 2012R2, but should work with Windows Server 2008 without modification. Will require both a system with OpenSSL (ideally Linux/OSX) and (obviously) a Windows Active Directory server.

@adamgell
adamgell / bat
Created July 13, 2018 13:44
UDADMIN CTX Licensing Clear
Remove all users:
for /f "tokens=1,2" %i in ('udadmin -list ^| find /i "_ud"') do @udadmin -f %j -user %i -delete
Remove all devices:
for /f "tokens=1,2" %i in ('udadmin -list ^| find /i "_ud"') do @udadmin -f %j -device %i -delete
# Download and dot source Get-WinEventData
# https://gallery.technet.microsoft.com/scriptcenter/Get-WinEventData-Extract-344ad840
. "\\path\to\Get-WinEventData.ps1"
# Download and Set up Sysmon as desired
# http://technet.microsoft.com/en-us/sysinternals/dn798348
# http://www.darkoperator.com/blog/2014/8/8/sysinternals-sysmon
#Use Get-WinEvent and Get-WinEventData to obtain events and extract XML data from them - let's see all the properties behind one!
Get-WinEvent -FilterHashtable @{logname="Microsoft-Windows-Sysmon/Operational";id=3} |
@adamgell
adamgell / README.md
Created August 14, 2014 01:05 — forked from AviDuda/README.md
#!/bin/bash
for f in *.html;
do
title=$( awk 'BEGIN{IGNORECASE=1;FS="<title>|</title>";RS=EOF} {print $2}' "$f" )
mv -i "$f" "${title//[^a-zA-Z0-9\._\- ]}".html
done