Skip to content

Instantly share code, notes, and snippets.

# -----------------------------------------------------------------------------
# Remove-DSACE.ps1
# Written by Bill Stewart (bstewart@iname.com)
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# This is a PowerShell script replacement for dsrevoke.exe:
# http://www.microsoft.com/en-us/download/details.aspx?id=19288
#
# Why write a replacement?
@Bill-Stewart
Bill-Stewart / getwinmsgs.pp
Created April 6, 2020 17:07
getwinmsgs.pp - FPC program to output Windows error codes and descriptions as CSV
{$MODE OBJFPC}
{$H+}
{$APPTYPE CONSOLE}
program getwinmsgs;
uses
windows;
var
@Bill-Stewart
Bill-Stewart / Get-InstalledApp.ps1
Created January 13, 2020 22:11
Get-InstalledApp.ps1
# Get-InstalledApp.ps1
# Written by Bill Stewart (bstewart@iname.com)
#
# Outputs installed applications on one or more computers that match one or
# more criteria.
#
# Version history:
#
# Version 1
# * Written for PowerShell 1.0. Lost in the mists of time.
@Bill-Stewart
Bill-Stewart / Get-ADGroupMembership.ps1
Created December 2, 2019 19:44
Get-ADGroupMembership.ps1
# Get-ADGroupMembership.ps1
# Written by Bill Stewart
#requires -version 2
# Version history:
# 1.0 (2019-12-02)
# * Initial version. Only searches the current domain.
<#
' EnforceLocalAdmin.vbs
' Written by Bill Stewart (bstewart@iname.com)
'
' This VBScript script allows you to update the membership of the
' Administrators group on one or more computers.
'
' The first unnamed argument is a comma-delimited list of accounts.
'
' Without /addonly or /removeonly, the Administrators group should contain only
' the named accounts.
# New-LocalUserAccount.ps1
# Written by Bill Stewart (bstewart@iname.com)
#
# The impetus for writing this script is the deprecation of the 'Local Users
# and Groups' Group Policy Preference. You can use this script as a computer
# startup script to safely create a local account on computers.
#
# Version history:
#
# 1.0 (2018-08-20)
# Get-DirStats.ps1
# Written by Bill Stewart (bstewart@iname.com)
#requires -version 2
# PowerShell wrapper script for the SysInternals du.exe command:
# https://docs.microsoft.com/en-us/sysinternals/downloads/du
# Why? Object output for sorting, filtering, calculating totals, etc.
#
# Version history:
# Set-ScheduledTaskCredential.ps1
# Written by Bill Stewart (bstewart@iname.com)
#requires -version 2
# Version history:
#
# Version 1.1 (18 Sep 2019)
# * Correct ShouldProcess (move to main process loop).
#
@Bill-Stewart
Bill-Stewart / Get-BitLockerRecovery.ps1
Created September 12, 2019 18:09
Gets BitLocker recovery information for one or more Active Directory computer objects
# Get-BitLockerRecovery.ps1
# Written by Bill Stewart (bstewart@iname.com)
#
# Version history:
# 1.1 (2019-09-12)
# * Dispose SearchResultCollection objects in 'finally' blocks.
# * Use second Pathname object to fix distinguishedName property output in rare
# case of multiple -PasswordID search results.
# * Throw ArgumentException for bad password ID (instead of generic exception).
# * Standardize code formatting.
@Bill-Stewart
Bill-Stewart / Reset-LocalAccountPassword.ps1
Last active August 10, 2023 09:49
Securely reset local account or the local Administrator account (RID 500) passwords
# Reset-LocalAccountPassword.ps1
# Written by Bill Stewart (bstewart AT iname.com)
#requires -version 2
# Version history:
#
# 1.4 (2023-04-10)
# * Account for null account reference.
# * Refined code formatting.