Skip to content

twcau/PowerShellScripting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PowerShellScripting

A collection of PowerShell scripts for enterprise IT administration, covering Active Directory, Microsoft 365, Exchange Online, Entra ID, and Intune management tasks that i've created over the years.

License: GPL v3 PowerShell Gallery Platform

For comprehensive documentation, please refer to the project site: https://twcau.github.io/PowerShellScripting/

Table of Contents

Features

My scripts so far cover some of the bugbears i've experienced in my time in L2-2.5 support, including:

  • Active Directory Management: User creation, group management, computer organisation, and bulk operations
  • Microsoft 365 Administration: Exchange Online mailbox management, quarantine handling, and transport rules
  • Entra ID Integration: External user management, compromised account remediation, and identity operations
  • Intune Device Management: Bulk device synchronisation, remediation scripts, and compliance monitoring
  • General Utilities: Password generation, module management, and script selection tools
  • OneDrive Administration: User content download and management capabilities

To ensure scripts are easily understood and used, I try to ensure they all include:

  • GUI Interfaces: User-friendly forms for complex administrative tasks
  • Error Handling: Robust error handling and retry logic for enterprise environments
  • Progress Updates: Visual feedback when an operation is underway but may take some time to complete
  • Comprehensive Logging: Standardised logging across all scripts with detailed audit trails
  • Documentation: At both the code, and use level, so it can be understood what everything does where

Getting Started

Prerequisites

  • PowerShell 7.0 or later
  • Windows operating system
  • Appropriate administrative permissions for target systems
  • Required PowerShell modules (see individual scripts for specific requirements):
    • Active Directory Module
    • Exchange Online Management
    • Microsoft Graph PowerShell SDK
    • Microsoft.Graph.Intune
    • MSOnline (where applicable)

Installation

  1. Clone the repository:

    git clone https://github.com/twcau/PowerShellScripting.git
  2. Navigate to the project directory:

    cd PowerShellScripting
  3. Review the script you want to use and install any required modules:

    # Example: Install Exchange Online Management module
    Install-Module -Name ExchangeOnlineManagement -Force
  4. Configure the scripts according to your environment (see Configuration section)

Usage

Please refer to each scripts' documentation for instructions on how to use it, including environment varibles, authentication, and customisation.

Folder Structure

PowerShellScripting/
├── ad/                                    # Active Directory scripts
│   ├── computer/
│   │   └── FindMachineOU.ps1              # Locate computer objects in AD
│   └── user/
│       ├── creation/                      # User account creation scripts
│       │   ├── AD-CopyGroups.ps1          # Copy group memberships
│       │   ├── User-Creation-Bulk.ps1     # Bulk user creation
│       │   ├── User-Creation.ps1          # Individual user creation with GUI
│       │   └── User-Departure.ps1         # User departure processing
│       └── reconcillation/                # User account reconciliation
│           ├── AD-Bulk-DepartedEmployeeReconcillation.ps1
│           ├── Employee-Departure-Reconciliation.ps1
│           └── Employee-Listing.ps1
├── e365/                                  # Exchange 365 scripts
│   ├── E365-Mailbox-ConvertToShared.ps1   # Convert mailboxes to shared
│   ├── E365-Quarantine-ExportRecord.ps1   # Export quarantine records
│   ├── Exchange-QuarantineTABL-DataDownload.ps1
│   └── NewTransportRuleExecName.ps1       # Transport rule management
├── entra/                                 # Entra ID (Azure AD) scripts
│   ├── AutomateCompromisedAccountRemediation.ps1
│   ├── Entra-UserExternal-Create.ps1      # External user creation
│   └── User-Management-External.ps1       # External user management
├── general/                               # General utility scripts
│   ├── ScriptSelector.ps1                 # Interactive script launcher
│   ├── module-management/                 # PowerShell module utilities
│   │   ├── Module-PowerShell7-Require.ps1
│   │   └── Update-Module.ps1
│   └── password-generation/               # Password generation tools
│       ├── Password-Generator-Silent.ps1
│       └── Password-Generator.ps1
├── intune/                                # Microsoft Intune scripts
│   ├── devices/
│   │   └── Intune-BulkSync.ps1            # Bulk device synchronisation
│   └── remediation/                       # Intune remediation scripts
│       ├── M365-VersionDetect.ps1         # M365 Apps version detection
│       ├── M365-VersionRemediate.ps1      # M365 Apps version remediation
│       ├── Teams-Old-Detect.ps1            # Legacy Teams detection
│       ├── Teams-Old-Remediate.ps1         # Legacy Teams remediation
│       ├── WinUpdate-23H2to24H2Force-Detect.ps1
│       ├── WinUpdate-23H2to24H2Force-Remediate.ps1
│       ├── WinUpdate-Outstanding-Detect.ps1           # Windows Update detection
│       ├── WinUpdate-Outstanding-Remediate.ps1        # Windows Update remediation
│       ├── WinUpdate-Pause-Detect.ps1     # Windows Update pause detection
│       └── WinUpdate-Pause-Remediate.ps1  # Windows Update pause remediation
├── m365/                                  # Microsoft 365 scripts
├── onedrive/                              # OneDrive management scripts
│   ├── M365-OneDriveForBusiness-User-FileDownload.ps1
│   └── M365-OneDriveForBusiness-User-FileUpload.ps1

Testing

Development Environment

Where available, testing scripts are located in the testing/ folder and include:

  • Proof-of-concept implementations
  • Version comparisons
  • Experimental features

Some scripts may also include dry run features in lieu of testing.

Validation

Before using scripts in production:

  1. Review the script documentation, header for version information and changelog
  2. Always test in a non-production environment
  3. Verify all required modules are installed
  4. Check logging output for any warnings or errors

Development Guidelines

  • Use Australian English (EN-AU) for documentation and comments
  • Include proper error handling and logging
  • Follow the established folder structure
  • Update this README when adding new functionality

Changelog

See individual script headers for detailed version history and changelog information.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Copyright (c) 2025, Michael Harris, All rights reserved.

Like to say thank you?

If these scripts have helped you in your IT administration tasks, consider:

  • ⭐ Starring this repository
  • 🐛 Reporting issues or suggesting improvements
  • 📖 Contributing to the documentation
  • Buy me a coffee to support continued development

Contact and Support

Project Maintainer

Getting Help

Common Issues

  • Module Import Errors: Ensure required PowerShell modules are installed
  • Authentication Failures: Verify credentials and MFA settings
  • Permission Errors: Check administrative rights for target systems
  • Network Connectivity: Ensure access to required cloud services

Support Resources

  • Check script headers for specific documentation links

  • Review Microsoft documentation for API changes

  • Consult PowerShell Gallery for module updates

  • Issues: Report bugs or request features via GitHub Issues

  • Discussions: Join the conversation in GitHub Discussions

  • Documentation: Review script headers and Microsoft documentation links

Support Guidelines

  • Provide clear descriptions of issues with relevant log files
  • Include PowerShell version and module information
  • Specify the target environment (on-premises, cloud, hybrid)
  • Follow the issue templates when reporting problems

Accessibility

This project is committed to accessibility and inclusive design:

  • Scripts include progress indicators and clear status messages
  • Documentation uses descriptive text for all functionality
  • Error messages provide actionable guidance
  • GUI interfaces follow accessibility best practices
  • All documentation supports screen readers

Contributing

Contributions to improve and expand this script collection are welcome. Please read the contribution guidelines:

  1. Code Standards: Follow PowerShell best practices and existing code style
  2. Documentation: Include comprehensive headers and inline comments
  3. Testing: Validate scripts in appropriate test environments
  4. Security: Ensure no hardcoded credentials or sensitive information

This project follows Microsoft PowerShell best practices and maintains compatibility with enterprise IT environments.