3 Must-Have PowerShell Scripts: Automate, Analyze, Monitor

3 Must-Have PowerShell Scripts You Can’t Miss

Automate your Windows workflows, enrich your data, and monitor performance—all with pure PowerShell.

1. Bulk-Migrate Local User Profiles to Azure AD

Streamline your tenant onboarding with a single script that transfers local Windows profiles to Azure AD accounts—settings, permissions, and all.


# Enumerate and migrate local profiles
enumerate local SIDs, create Azure AD accounts via MSGraph
copy profile folder, update registry, set ACLs
unload old profile, restart Explorer

2. Batch Reverse-Geocode Coordinates from CSV

Convert latitude/longitude pairs to human-readable addresses in bulk, using a free reverse-geocode API. Perfect for offline or budget workflows.


param(
  [string]$inputCsv = 'coords.csv',
  [string]$outputCsv = 'addresses.csv'
)
Import-Csv $inputCsv | ForEach-Object {
  $lat = $_.Latitude; $lon = $_.Longitude
  $url = "https://geocode.maps.co/reverse?lat=$lat&lon=$lon"
  $resp = Invoke-RestMethod $url -ErrorAction Stop
  [pscustomobject]@{
    Latitude = $lat
    Longitude = $lon
    Address = $resp.display_name
  }
} | Export-Csv $outputCsv -NoTypeInformation

3. Real-Time Perf Counter HTML Dashboard

Launch a lightweight dashboard with auto-refreshing charts—no external modules required. Monitor CPU, memory, and I/O in your browser.


# Define counters
$counters = '\\Processor(_Total)\\% Processor Time', \\
    '\\Memory\\Available MBytes'
# Sample and serve JSON
$data = Get-Counter -Counter $counters -SampleInterval 2 -MaxSamples 30 |
  ForEach-Object { [pscustomobject]@{ Time = $_.Timestamp; Values = $_.CounterSamples } }
$json = $data | ConvertTo-Json
# Generate HTML with embedded Chart.js, start HttpListener on port 8080
dotnet script or native HttpListener code here...
🚀 Share This Post!

Empower your team—spread the word!

#PowerShell #Automation #AzureAD #DevOps #SysAdmin


Leave a Reply

Your email address will not be published. Required fields are marked *