#
PowerShellScripting Documentation Site
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.
#
Table of Contents
Table of Contents Script Categories Interactive Scripts
Usage Basic Usage
Scripts available Active Directory (ad) Exchange / E365 (e365) Entra ID / Azure AD (entra) General utilities (general) Intune (intune) OneDrive / SharePoint (onedrive)
Configuration Environment Variables Authentication Customisation
Testing Validation
Logging and Troubleshooting Logging Standards Common Issues Support Resources
Accessibility Contributing Development Guidelines
Changelog Recent Updates Version History
License Like to say thank you? Contact and Support Project Maintainer Getting Help Support Guidelines
#
Script Categories
Details of all scripts, and links to their documentation, can be found in the Scripts section below.
- Active Directory: Scripts for user and computer management in on-premises AD environments
- Exchange 365: Email and mailbox management for cloud and hybrid environments
- Entra ID: Identity and access management for Azure AD/Entra ID
- General: Utility scripts for common administrative tasks
- Intune: Detection and remediation scripts to keep your house in order
- Microsoft 365: Microsoft 365 Relevant scripts
- Onedrive: Onedrive for Business and SharePoint bulk file upload/download scripts
#
Interactive Scripts
Many scripts include GUI interfaces for ease of use:
- User creation wizards with form-based input
- Device selection interfaces
- Progress indicators for long-running operations
#
Usage
#
Basic Usage
Each script is designed to be run independently. Navigate to the appropriate folder and execute the script:
# Example: Run user creation script
.\ad\user\creation\User-Creation.ps1
# Example: Run Intune bulk sync
.\intune\devices\Intune-BulkSync.ps1
#
Scripts available
#
Active Directory (ad)
#
Exchange / E365 (e365)
#
Entra ID / Azure AD (entra)
#
General utilities (general)
#
Intune (intune)
#
OneDrive / SharePoint (onedrive)
#
Configuration
#
Environment Variables
Some scripts may require environment-specific configuration. Review each script's header for specific requirements.
#
Authentication
- Ensure you have appropriate administrative credentials
- Some scripts require multi-factor authentication (MFA)
- Consider using application passwords where applicable
#
Customisation
Scripts include configurable parameters at the top of each file. Common customisations include:
- Domain names and organisational units
- Email domains and Exchange settings
- Logging paths and retention policies
- Timeout values and retry attempts
#
Testing
#
Validation
Before using scripts in production:
- Review the script header for version information and changelog
- Test in a non-production environment
- Verify all required modules are installed
- Check logging output for any warnings or errors
#
Logging and Troubleshooting
#
Logging Standards
All scripts are intended to follow consistent logging practices, which include:
- Log files stored in
$env:TEMPwith timestamps where appropriate - Comprehensive error logging with context
- Success and failure reporting
- Progress indicators for long-running operations
Script documentation will provide examples of what logging is provided, and samples of logging output.
#
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
#
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:
- Code Standards: Follow PowerShell best practices and existing code style
- Documentation: Include comprehensive headers and inline comments
- Testing: Validate scripts in appropriate test environments
- Security: Ensure no hardcoded credentials or sensitive information
#
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
#
Recent Updates
Changelog for each script will be provided on its documentation page where relevant.
- Integrated CleanMgr registry preparation for selected VolumeCaches and invoked CleanMgr (/sagerun:1).
- Configured and triggered Storage Sense to remove temporary files and locally cached OneDrive content.
- Added DISM component store cleanup (StartComponentCleanup) with explicit exit-code logging.
- Added removal of user-specific temporary files (%USERPROFILE%\AppData\Local\Temp).
- Enhanced event log cleanup:
- Improved error handling for individual logs to ensure the script continues processing other logs.
- Added removal of old user profiles from C:\Users based on retention days ($userProfileRetentionDays).
- Centralised logging with Start-Transcript and Custom-WriteLog; log file located at $env:TEMP<scriptName>.log.
- Improved error handling so individual step failures are logged as warnings and the script continues.
- Exposed configuration variables for operational tuning:
- $logsToClear: List of event logs to process.
- Added initialisation of $freeSpaceGB to capture baseline free space before cleanup, ensuring accurate space-recovered reporting.
- Validated archive directory existence before appending or moving logs.
- Appended new logs to existing archive files or created new archive files as needed.
- Executed Disk Cleanup silently using the /VERYLOWDISK argument.
- Documented exit codes:
- 0 = Success
- 1 = General failure (useful for external monitoring; individual step failures do not necessarily change the final exit code unless a fatal condition is detected).
#
Version History
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 full terms and conditions.
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
- Michael Harris - @twcau
#
Getting Help
- 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
This project makes reasonable efforts to follow Microsoft PowerShell best practices and maintains compatibility with enterprise IT environments.