Skip to content

Instantly share code, notes, and snippets.

@Bill-Stewart
Bill-Stewart / AccessBasedEnumeration.psm1
Created April 27, 2018 20:36
Windows PowerShell module for managing access-based enumeration for shares
# AccessBasedEnumeration.psm1
# Written by Bill Stewart
#
# This Windows PowerShell module manages access-based enumeration for shares.
#
# Access-based enumeration causes the operating system to display only file
# system items that a user has permission to access. If a user does not have
# read (or equivalent) permissions for an item, the operating system hides the
# item from the user's view. Access-based enumeration is active only when
# viewing file system items from a share; it does not affect a user's view of
@Bill-Stewart
Bill-Stewart / Get-Uptime.ps1
Created June 1, 2018 20:37
Get-Uptime.ps1 - Use WMI to get last boot and uptime
# Get-Uptime.ps1
# Written by Bill Stewart (bstewart@iname.com)
#
# Outputs uptime for one or more computers. Uptime is determined by the
# LastBootUpTime property from the Win32_OperatingSystem WMI class.
#requires -version 2
<#
.SYNOPSIS
@Bill-Stewart
Bill-Stewart / Set-ServiceCredential.ps1
Created June 1, 2018 20:44
Sets start credentials for one or more services on one or more computers
# Set-ServiceCredential.ps1
# Written by Bill Stewart (bstewart@iname.com)
#
# PowerShell script for setting credentials for one or more services on one or
# more computers.
#
# See http://www.itprotoday.com/management-mobility/changing-service-credentials-using-powershell
#requires -version 2
@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.
@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.
# 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).
#
# 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:
# 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)
' 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.
@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.
<#