Skip to content

Instantly share code, notes, and snippets.

# Get-RegistryValue.ps1
# Written by Bill Stewart (bstewart AT iname.com)
# Version History
#
# 2025-12-18
# * Initial version.
#requires -version 5.1
# Update-ADGroupFromLDAPQuery.ps1
# Written by Bill Stewart (bstewart AT iname.com)
<#
Notes about this script:
* Import the ActiveDirectory module BEFORE running this script; one easy way to
do this is to write a "wrapper" script that calls this one (e.g., if you want
to schedule this using the Task Scheduler).
<#
Clear-SmartcardCache.ps1
Written by Bill Stewart
We have seen some instances where a user gets a new smartcard certificate and
they are unable to log on due to cached data in the local registry.
The purpose of this script is to remove this cached data from the registry
to fix this prompt. The script makes a backup copy of the registry subkey to
#requires -version 3
# Version history:
#
# 2025-07-22
# * Support pipeline input.
#
# 2025-07-14
# * Added spaces in binary string output to improve readability.
#
# ConvertTo-BinaryString.ps1
# Written by Bill Stewart (bstewart AT iname.com)
# I wrote this for two main reasons...
# * "b" format specifier not universally available
# * [Convert]::ToString() doesn't support UInt64 values
<#
.SYNOPSIS
Converts an unsigned integer to a binary string.
# New-CertificateSigningRequest.ps1
# Written by Bill Stewart (bstewart AT iname.com)
# Windows provides the 'certreq -New' command to generate a certificate signing
# request (CSR) file, but the "policy" (.inf) file format it requires is arcane
# and cumbersome to format correctly. One of the the primary purposes of this
# script is to provode an easier-to-use INI file format that makes it simpler
# to specify the subject and subject alternative names (SANs) for the CSR
# without worrying about the formatting requirements of the .inf file.
#
# Update-VirtualBoxWindowsAdditions.ps1
# Written by Bill Stewart (bstewart AT iname.com)
#
# Updates the VirtualBox Guest Additions on a VirtualBox VM.
#
# Prerequisites:
# * The VirtualBox Guest Additions ISO must be mounted in a VM optical drive
# * The Guest Additions must already be installed
#
# Version history:
# Start-ScheduledTaskCommand.ps1
# Written by Bill Stewart (bstewart AT iname.com)
# This script provides a simple way to execute a command one one or more remote
# computers using the Task Scheduler service. Uses the Task Scheduler scripting
# objects:
# https://learn.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-objects
# If you're using the Windows firewall, you'll need the 'Remove Scheduled Tasks
# Management' inbound rules (or equivalent) in place on remote machines.
#
# New-OpenSSLCertReq.ps1
# Written by Bill Stewart (bstewart AT iname.com)
#requires -version 3
<#
.SYNOPSIS
Generates a private key and certificate signing request (CSR) using OpenSSL.
# Wait-NetConnectionDomain.ps1
# Written by Bill Stewart
# Under certain circumstances, Windows might not detect it's network location
# correctly. The most obvious manifestation of this problem is that the Windows
# Firewall 'profile' gets set to the wrong network. On a domain, this can be a
# headache when firewall rules are set to only be active for the 'Domain'
# firewall profile. It seems that, under some conditions on domain-joined
# computers, the Network Location Awareness (NlaSvc) service doesn't update
# its status correctly.