Skip to content
 
 

Repository files navigation

PowerShell Administrative Scripts Collection

A comprehensive collection of PowerShell scripts for system administration, focusing on Azure AD, Windows Updates, and system maintenance tasks.

🚀 Quick Start

Clone this repository and run the scripts with appropriate permissions. Most scripts require administrative privileges and specific PowerShell modules.

# Clone the repository
git clone https://github.com/roalhelm/PowershellScripts.git

# Navigate to the script directory
cd PowershellScripts

# Run GUI tool for device management
.\AddAADDeviceToAADGroup\DevicetoAADGroupGUI.ps1

📋 Requirements

  • PowerShell 5.1 or higher
  • Administrative privileges
  • Required PowerShell modules:
    • AzureAD
    • PSWindowsUpdate
    • ActiveDirectory
    • Microsoft.Graph (for some Azure AD operations)

📦 Script Overview

Azure AD Management Scripts

GUI Tools

  • DevicetoAADGroupGUI.ps1
    • Modern Windows Forms interface
    • Live device list preview
    • Multiple input format support
    • Integrated AAD group management
    • Real-time validation

Core Functions

  • Add-DevicesToAADGroupFunction.ps1
    • Reusable AAD group management function
    • Detailed operation logging
    • Error handling and reporting
    • Status object return
    • CSV file support

Utility Scripts

  • Verifies device existence in Azure AD
  • Processes devices from CSV input file
  • Creates separate CSV files for found/not found devices
  • Outputs detailed summary statistics
  • Adds devices to specified Azure AD groups
  • Supports bulk operations via CSV input
  • Checks for existing group memberships
  • Provides detailed logging of operations
  • GUI tool for creating device lists
  • Manages CSV files for AAD operations
  • Supports comma, semicolon, or space-separated input
  • Includes cleanup functionality

System Maintenance Scripts

  • Advanced WMI repository repair tool
  • Supports local and remote computer repair
  • Manages WMI repository folders
  • Verifies and repairs WMI consistency
  • Repairs/reinstalls Intune Management Extension
  • Stops required services
  • Removes existing installation
  • Triggers new installation
  • Updates system drivers via Windows Update
  • Manages BitLocker status during updates
  • Creates detailed operation logs
  • Supports both local and remote execution

Windows Update Management

  • Resets Windows Update components
  • Cleans update cache
  • Removes problematic group policies
  • Triggers update scan cycles

User Management

  • Compares group memberships between users
  • Shows differences in group memberships
  • Supports AD and Azure AD comparison

Intune Management

  • Detection.ps1: Checks last Intune sync time
  • Remediation.ps1: Forces Intune sync if needed

Dell Management

  • detectDellCommandUpdate.ps1: Checks DCU installation
  • remediatDellCommandUpdate.ps1: Removes DCU if found

🔧 Usage

Most scripts include detailed help information. Use PowerShell's Get-Help for details:

Get-Help .\ScriptName.ps1 -Full

Example for AADChecker:

.\AddAADDeviceToAADGroup\AADChecker.ps1

📊 Usage Examples

# Add devices to AAD group using GUI
.\DevicetoAADGroupGUI.ps1

# Add devices using function
$result = Add-DevicesToAADGroup -GroupName "TestGroup" -CsvPath ".\Devices.csv"

# Check AAD device status
.\AADChecker.ps1 -InputFile "devices.csv"

📝 Logging

Scripts create logs in appropriate locations:

  • Windows Event Log for system operations
  • Custom log files in %ProgramData% for specific operations
  • Text file logs in script directories

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

📄 License

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

About

Collection of Powershell Scripts

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages