💻 PowerShell is an IT Admin’s best friend—whether you’re managing Active Directory, troubleshooting network issues, or automating daily tasks. These essential commands will help you work smarter, not harder.
🔹 1. Find All Locked-Out Users in Active Directory
🛑 Identify locked-out accounts instantly.
powershellCopyEditSearch-ADAccount -LockedOut | Select-Object Name, SamAccountName, LockedOut
✅ Use Case: Quickly locate and assist locked-out users.
🔹 2. Unlock a User’s Account in Active Directory
🔓 Unlock a user’s account without using the GUI.
powershellCopyEditUnlock-ADAccount -Identity jdoe
✅ Use Case: Enables IT admins to resolve lockouts in seconds.
🔹 3. Force a Password Reset for a User
🔄 Require a user to change their password at next login.
powershellCopyEditSet-ADUser -Identity jdoe -PasswordNeverExpires $false -ChangePasswordAtLogon $true
✅ Use Case: Ensures security compliance without manual resets.
🔹 4. Retrieve System Boot Time
🖥️ Check how long a system has been running.
powershellCopyEdit(Get-Date) - (gcim Win32_OperatingSystem).LastBootUpTime
✅ Use Case: Displays uptime in days, hours, and minutes.
🔹 5. List Running Services with “Stopped” Status
🚀 Check which services aren’t running.
powershellCopyEditGet-Service | Where-Object { $_.Status -eq 'Stopped' } | Select-Object Name, DisplayName
✅ Use Case: Helps identify critical services that need restarting.
🔹 6. Test Internet Connectivity
🌐 Check if a machine has an active internet connection.
powershellCopyEditTest-NetConnection -ComputerName google.com -InformationLevel Detailed
✅ Use Case: Quick and easy network diagnostics.
🔹 7. Find the Last 10 Failed Login Attempts
🚫 Track failed login attempts for security auditing.
powershellCopyEditGet-EventLog -LogName Security -InstanceId 4625 -Newest 10
✅ Use Case: Detects brute-force attacks and failed password attempts.
🔹 8. Get a List of Users with Expired Passwords
🔑 Find all users with expired passwords in Active Directory.
powershellCopyEditSearch-ADAccount -PasswordExpired | Select-Object Name, SamAccountName
✅ Use Case: Prevents user lockouts and ensures password updates.
🔹 9. Get Disk Space Usage on a Server
💾 Check available disk space across all drives.
powershellCopyEditGet-PSDrive | Where-Object {$_.Provider -like "Microsoft.PowerShell.Core\FileSystem"} |
Select-Object Name, Used, Free
✅ Use Case: Helps avoid storage-related downtime before it happens.
🔹 10. List & Stop Running Processes
⚡ View active processes and terminate any misbehaving ones.
powershellCopyEditGet-Process | Select-Object ProcessName, Id, CPU | Format-Table -AutoSize
Stop-Process -Name "notepad" -Force
✅ Use Case: Quickly terminate resource-hogging processes without Task Manager.
🚀 Conclusion: Work Smarter, Automate More!
💡 PowerShell is a game-changer for IT admins, allowing faster troubleshooting, better automation, and enhanced security monitoring. Whether you’re managing user accounts, securing systems, or optimizing network performance, these commands will save time and effort.
🖥️ Next Steps?
📌 Bookmark this page and check back for more advanced PowerShell scripts!
🔗 Need more automation tips? Visit the PowerShell Hub for deeper insights.
© 2012–2025 Jet Mariano. All rights reserved.
For usage terms, please see the Legal Disclaimer.