A comprehensive collection of PowerShell scripts for system administration, Active Directory management, user configuration, and network operations.
- Overview
- Repository Structure
- Key Features
- Prerequisites
- Script Categories
- Script Categories
- Usage Examples
- Contributing
- Author
This repository contains a variety of PowerShell scripts designed for enterprise system administration tasks, including:
- Date Format Management: Tools for managing and standardizing date formats across user profiles
- Active Directory Operations: Scripts for user and computer management in AD environments
- Network Administration: Network scanning, ping utilities, and IP configuration tools
- Printer Management: Automated network printer setup and configuration
- System Maintenance: Computer management, RDP fixes, and system diagnostics
- Problem Steps Recorder Tools: PSR configuration and automation for support workflows
- Web Reporting: HTML report generation and styling tools
- Disaster Recovery: DR testing and verification scripts
PowerShellScripts/
βββ Scripts/ # All executable scripts organized by topic
β βββ ActiveDirectory/ # Active Directory management scripts
β β βββ Get-UserComputer.ps1 # Find last logon workstation
β β βββ Get-ComputerLastOnline.ps1 # Get computer last online status
β β βββ Add-UsersInOuToGroup.ps1 # Bulk group membership management
β β βββ Disable-AndMoveComputers.ps1 # Computer object cleanup
β β βββ Set-ScheduledTaskAccount.ps1 # Scheduled task migration
β βββ DateFormat/ # Date format management scripts
β β βββ Get-UserDateFormats.ps1 # Retrieve date formats from remote servers
β β βββ Set-UserDateFormats.ps1 # Set standardized date formats
β βββ RegionFormat/ # Region format management scripts
β β βββ Get-UserRegionFormats.ps1 # Retrieve region formats from remote servers
β β βββ Set-UserRegionFormats.ps1 # Set standardized region formats
β βββ Network/ # Network and connectivity tools
β β βββ Scan-Network.ps1 # Network discovery and analysis
β β βββ Ping-WithChime.ps1 # Enhanced ping with audio
β β βββ Get-ComputersViaIP.ps1 # Computer discovery via IP
β β βββ Reset-IPConfig.ps1 # Network configuration reset
β β βββ Fix-RDP.ps1 # RDP troubleshooting
β β βββ Test-MacAddress.ps1 # MAC address testing
β βββ Printers/ # Printer management (consolidated)
β β βββ addNetworkPrinters.ps1 # Automated printer installation
β β βββ Diagnose-PrintError.ps1 # Print spooler diagnostics
β β βββ Repair-PrintSpooler.ps1 # Print spooler repair
β βββ ProblemStepsRecorder/ # PSR automation tools
β β βββ Set-PSRLocation.ps1 # Configure PSR output location
β β βββ Start-PSR.ps1 # Launch PSR with custom settings
β βββ Reporting/ # HTML and web reporting tools
β β βββ Test-PSWriteHTML.ps1 # HTML table generation
β β βββ table-style.css # CSS styling for reports
β β βββ wdw-snippet.html # HTML template file
β βββ WindowsUpdate/ # Windows Update management
β βββ Uninstall-WindowsUpdate.ps1 # Remove Windows updates
β
βββ Modules/ # PowerShell modules
β βββ ActiveDirectoryUtils/ # Shared Active Directory helper functions
β βββ RegistryUtils/ # Shared registry helpers (DateFormat & RegionFormat)
β βββ PersonalUtils/ # Copilot and terminal helpers
β
βββ Tests/ # Pester test files
β βββ ActiveDirectory/ # AD script tests
β βββ DateFormat/ # Date format script tests
β βββ RegionFormat/ # Region format script tests
β βββ WindowsUpdate/ # Windows Update script tests
β
βββ Data/ # Input files and documentation
β βββ InputFiles/ # Configuration files and user lists
β βββ Documentation/ # Reference documentation and guides
β
βββ Output/ # Script execution outputs
βββ DateFormats/ # Date format script results
βββ RegionFormats/ # Region format script results
βββ EndpointCentral/ # Endpoint Central outputs
βββ DisasterRecovery/ # DR test results
βββ Reports/ # General reports and logs
- Centralized Control: Manage date formats across multiple servers and user profiles
- Bulk Operations: Process hundreds of users simultaneously
- CSV Export: Comprehensive reporting with CSV output
- Remote Execution: PowerShell remoting support for enterprise environments
- Localization Support: Manage Windows Settings region format (LocaleName) across servers
- Culture Code Support: Apply any valid culture code (en-US, nl-NL, de-DE, etc.)
- Bulk Operations: Process hundreds of users simultaneously
- CSV Export: Track old and new region formats with timestamped reports
- Remote Execution: PowerShell remoting with 1Password credential integration
- User Information Retrieval:
Get-UserInfosurfaces display name, password status, and last logon data straight from the module - Reusable Module Helpers: Import
ActiveDirectoryUtilsfor functions likeGet-UserInfoandGet-UserComputer - Self-Healing RSAT Support: Automatic RSAT installation attempts when the Active Directory module is missing; graceful "limited mode" warnings when installation isn't possible
- Group Management: Add/remove users from AD groups with organizational unit filtering
- Computer Management: Disable and move computer objects efficiently
- Network Scanning: Comprehensive network discovery and analysis
- IP Management: IP configuration reset and troubleshooting tools
- Connectivity Testing: Enhanced ping utilities with audio notifications
- Automated Setup: Batch network printer installation
- User-Specific Configuration: Per-user printer deployment tracking
- Error Handling: Comprehensive logging and error reporting
- PowerShell 7+ (Preferred) or Windows PowerShell 5.1 for legacy compatibility
- Active Directory Module (for AD-related scripts)
- Administrative Privileges (for most system-level operations)
- PowerShell Remoting enabled (for remote server operations)
# Install required modules (ActiveDirectoryUtils will attempt RSAT install automatically)
Import-Module .\Modules\RegistryUtils\RegistryUtils.psd1
Import-Module .\Modules\ActiveDirectoryUtils\ActiveDirectoryUtils.psd1
```> **Heads up:** Importing `Modules\ActiveDirectoryUtils` validates that the RSAT Active Directory tools are present. If you're elevated it will install them for you; otherwise the module logs a warning and continues in a read-only limited mode.
## π¦ Installation
1. **Clone the repository:**
```powershell
git clone https://github.com/J-MaFf/PowerShellScripts.git
cd PowerShellScripts-
Import the custom modules:
Import-Module .\Modules\RegistryUtils\RegistryUtils.psd1 Import-Module .\Modules\ActiveDirectoryUtils\ActiveDirectoryUtils.psd1
-
Set execution policy (if needed):
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
| Script | Description |
|---|---|
Scripts/DateFormat/Get-UserDateFormats.ps1 |
Retrieves date format information from remote servers |
Scripts/DateFormat/Set-UserDateFormats.ps1 |
Sets standardized date formats across user profiles |
| Script | Description |
|---|---|
Scripts/RegionFormat/Get-UserRegionFormats.ps1 |
Retrieves region format (LocaleName) from remote servers |
Scripts/RegionFormat/Set-UserRegionFormats.ps1 |
Sets standardized region formats across user profiles |
New in Latest Release:
- Optional
-Credentialparameter for secure credential passing without prompts - Enhanced 1Password support for both KFI and KGS domains
- 72 comprehensive Pester tests (100% pass rate)
- Improved error handling with clear status messaging
| Script | Description |
|---|---|
Modules/ActiveDirectoryUtils |
Shared module exporting 8 functions: Get-UserInfo, Get-UserComputer, Get-ComputerLastLogon, Test-Admin-Privileges, and others |
Scripts/ActiveDirectory/Get-UserComputer.ps1 |
Wrapper that prompts for elevation, accepts credentials, and calls Get-UserComputer |
Scripts/ActiveDirectory/Get-ComputerLastOnline.ps1 |
Get computer last online status from Active Directory |
Scripts/ActiveDirectory/Add-UsersInOuToGroup.ps1 |
Bulk group membership management |
Scripts/ActiveDirectory/Disable-AndMoveComputers.ps1 |
Computer object management and cleanup |
Scripts/ActiveDirectory/Set-ScheduledTaskAccount.ps1 |
Migrate scheduled tasks between accounts |
| Script | Description |
|---|---|
Scripts/Network/Scan-Network.ps1 |
Network discovery and port scanning |
Scripts/Network/Ping-WithChime.ps1 |
Enhanced ping with audio notifications |
Scripts/Network/Get-ComputersViaIP.ps1 |
Computer discovery via IP ranges |
Scripts/Network/Reset-IPConfig.ps1 |
Network configuration reset utility |
Scripts/Network/Fix-RDP.ps1 |
Remote Desktop Protocol troubleshooting |
Scripts/Network/Test-MacAddress.ps1 |
MAC address testing and validation |
| Script | Description |
|---|---|
Scripts/ProblemStepsRecorder/Set-PSRLocation.ps1 |
Configures PSR to save recordings to network location |
Scripts/ProblemStepsRecorder/Start-PSR.ps1 |
Launches PSR with preconfigured settings and timestamped output |
| Script | Description |
|---|---|
Scripts/Reporting/Test-PSWriteHTML.ps1 |
Creates HTML tables with PSWriteHTML module |
Scripts/Reporting/table-style.css |
CSS styling for HTML table outputs |
Scripts/Reporting/wdw-snippet.html |
HTML template/snippet file |
| Script | Description |
|---|---|
Scripts/Printers/addNetworkPrinters.ps1 |
Automated network printer installation |
Scripts/Printers/User.bat |
User-level printer setup batch file |
Scripts/Printers/Diagnose-PrintError.ps1 |
Comprehensive Print Spooler diagnostics and troubleshooting |
Scripts/Printers/Repair-PrintSpooler.ps1 |
Print Spooler repair and recovery automation |
| Script | Description |
|---|---|
Scripts/WindowsUpdate/Uninstall-WindowsUpdate.ps1 |
Remove specific Windows updates with safety checks |
- Exports 8 AD utility functions including
Get-UserInfo,Get-UserComputer,Get-ComputerLastLogon,Test-Admin-Privileges, and others - Attempts to install RSAT AD DS tools automatically during import when they're missing
- Emits
β οΈ limited-mode warnings instead of throwing when AD cmdlets are unavailable - Shared helpers power the
Scripts/ActiveDirectory/script wrappers and the associated Pester tests (Tests/ActiveDirectory/*.Tests.ps1)
- Centralizes remoting helpers, credential cascades via 1Password CLI, and CSV export logic
- Required by scripts under
Scripts/DateFormat/βimported automatically by those entry points - Keeps timestamped exports under
Output/DateFormats/for easy auditing
- Shared module for registry-based Windows Settings management (renamed from UserDateFormatUtils)
- Exports functions for both DateFormat and RegionFormat operations
- Includes
Get-UserRegionFormat()andSet-UserRegionFormat()for region format management - Includes
Get-UserSystemShortDateFormat()andSet-RemoteUserDateFormat()for date format management - Centralizes remoting helpers, credential cascades via 1Password CLI, and CSV export logic
- Required by scripts under
Scripts/DateFormat/andScripts/RegionFormat/ - Keeps timestamped exports under
Output/DateFormats/andOutput/RegionFormats/for easy auditing
# Get date formats from default server (10.210.3.23)
$creds = Get-Credential -UserName 'KFI\admin-jmaffiola'
.\Scripts\DateFormat\Get-UserDateFormats.ps1 -Credential $creds
# Target specific users with pre-stored credentials
.\Scripts\DateFormat\Get-UserDateFormats.ps1 -TargetUsers @('bbenson', 'bbenson.kfi') -Credential $creds -OutputPath "C:\Reports\DateFormats.csv"
# Use a user list file
.\Scripts\DateFormat\Get-UserDateFormats.ps1 -UserListFile "C:\lists\users.txt" -Credential $creds
# Set date format to Month/Day/Year (M/d/yyyy)
.\Scripts\DateFormat\Set-UserDateFormats.ps1 -TargetUsers @('user1', 'user2') -DateFormat 'M/d/yyyy' -Credential $creds
# Set date format from file without credential prompts
.\Scripts\DateFormat\Set-UserDateFormats.ps1 -UserListFile "users.csv" -DateFormat 'yyyy-MM-dd' -Credential $credsFeatures:
- Optional Credential parameter eliminates interactive prompts
- Pre-store credentials:
$creds = Get-Credentialthen reuse in scripts - Automatic 1Password fallback (if OP_KFI or OP_KGS environment variables configured)
- CSV export with timestamped filenames
# Get region formats from default server (10.210.3.23)
$creds = Get-Credential -UserName 'KFI\admin-jmaffiola'
.\Scripts\RegionFormat\Get-UserRegionFormats.ps1 -Credential $creds
# Get region formats for specific users
.\Scripts\RegionFormat\Get-UserRegionFormats.ps1 -TargetUsers @('user1', 'user2') -Credential $creds
# Get region formats from a user list file
.\Scripts\RegionFormat\Get-UserRegionFormats.ps1 -UserListFile "C:\lists\users.txt" -Credential $creds
# Set region format to English (United States) - fixes Crystal Reports Dutch text issue
.\Scripts\RegionFormat\Set-UserRegionFormats.ps1 -RegionFormat 'en-US' -Credential $creds
# Set region format for specific users only
.\Scripts\RegionFormat\Set-UserRegionFormats.ps1 -TargetUsers @('user1', 'user2') -RegionFormat 'en-US' -Credential $creds
# Set region format from file with custom region
.\Scripts\RegionFormat\Set-UserRegionFormats.ps1 -UserListFile "users.csv" -RegionFormat 'de-DE' -Credential $credsSupported Region Formats:
en-US- English (United States)nl-NL- Dutch (Netherlands)de-DE- German (Germany)fr-FR- French (France)es-ES- Spanish (Spain)- And many other valid Windows culture codes
Features:
- Validates culture code before applying changes
- Tracks old and new region formats in CSV reports
- Optional Credential parameter eliminates interactive prompts
- Automatic 1Password credential fallback
- CSV export with timestamped filenames
# Get user information
Get-UserInfo -username "jsmith"
# Module-based password expiry lookup (supports arrays and pipeline input)
Get-UserInfo -Username "jsmith"
'adoe','bwhite' | Get-UserInfo
# Find the last logon computer (prompts to elevate if needed)
.\Scripts\ActiveDirectory\Get-UserComputer.ps1 -UserName "jsmith" -ReturnAllEvents
# Provide delegated credentials when the current session isn't elevated
.\Scripts\ActiveDirectory\Get-UserComputer.ps1 -UserName "jsmith" -Credential (Get-Credential)When run without administrative rights, Get-UserComputer.ps1 now offers to relaunch itself elevated while preserving the arguments you supplied. Supplying the optional -Credential parameter allows the script to query domain controller Security logs without prompting for elevation.
Get-UserInfo formats its results into a table for interactive readability. Add -Verbose to trace domain policy lookups, and copy the function from the module if you need to emit raw objects instead of formatted output.
# Scan network with progress indicators
.\Scripts\Network\Scan-Network.ps1
# Enhanced ping with sound notifications
.\Scripts\Network\Ping-WithChime.ps1 -Target "192.168.1.1"# Add network printers from configuration file
.\Scripts\Printers\addNetworkPrinters.ps1# Configure PSR to save to network location
.\Scripts\ProblemStepsRecorder\Set-PSRLocation.ps1
# Start PSR with custom settings
.\Scripts\ProblemStepsRecorder\Start-PSR.ps1 -OutputPath "C:\Support\Recordings" -Prefix "Issue_" -Screenshots 25# Generate HTML table report
.\Scripts\Reporting\Test-PSWriteHTML.ps1 -OutputPath "C:\Reports\SystemReport.html"Most scripts generate detailed output files in the Output/ directory:
- CSV Reports: Structured data exports for analysis (in
Output/DateFormats/andOutput/Reports/) - Transcript Logs: Complete execution logs with timestamps
- Error Reports: Detailed error tracking and troubleshooting information
- Progress Tracking: Real-time operation status updates
Outputs are organized by category:
Output/DateFormats/- Date format management resultsOutput/RegionFormats/- Region format management resultsOutput/EndpointCentral/- Endpoint Central group operationsOutput/DisasterRecovery/- DR verification resultsOutput/Reports/- General reports and logs
This repository includes comprehensive Pester test suites:
# Run all tests
Invoke-Pester -Script 'Tests/' -Output Normal
# Run specific test suite
Invoke-Pester -Script 'Tests/DateFormat/' -Output Normal
Invoke-Pester -Script 'Tests/RegionFormat/' -Output Normal
Invoke-Pester -Script 'Tests/ActiveDirectory/' -Output Normal
# Test specific file
Invoke-Pester -Script 'Tests/DateFormat/Get-UserDateFormats.Tests.ps1' -Output Detailed
Invoke-Pester -Script 'Tests/RegionFormat/Set-UserRegionFormats.Tests.ps1' -Output DetailedCurrent Test Coverage:
- DateFormat Scripts: 72 tests (100% passing)
- RegionFormat Scripts: 49 tests (100% passing)
- ActiveDirectory Scripts: Comprehensive AD module tests
- Includes parameter validation, error handling, output formatting, and module dependency tests
- Scripts require appropriate permissions for their respective operations
- Credential handling follows PowerShell best practices
- Remote execution uses secure PowerShell remoting protocols
- Administrative privileges are verified before system-level operations
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch
- Follow PowerShell best practices
- Include comprehensive help documentation
- Test scripts thoroughly
- Submit a pull request
- Use approved PowerShell verbs
- Include comprehensive comment-based help
- Implement proper error handling
- Follow consistent naming conventions
- Include parameter validation
- System Administrator & PowerShell Developer
- Focus on enterprise automation and infrastructure management
This project is available for educational and professional use. Please review individual script headers for specific usage guidelines.
- Install required PowerShell modules
- Set appropriate execution policy
- Configure PowerShell remoting (if using remote scripts)
- Verify Active Directory module availability
- Test with non-production environment first
- Review script parameters and documentation
For questions or issues:
- Check the script's comment-based help:
Get-Help .\ScriptName.ps1 -Full - Review the generated log files in
Script output/ - Verify prerequisites and permissions
- Create an issue in this repository for bugs or feature requests
Last updated: November 21, 2025