Windows PowerShell Cmdlets for troubleshooting

1. Get-Command: List all the commands available for use in your current session. For example, to list all commands with get-Win,-win*

2. Get-Service: show what services are installed on the system. For example, you want to list all running services, use Get-Service | Where-Object {$_.Status -eq “Running”}

3. Set-Location -Path [full path]: change directory. For example,

4. Get-TroubleshootingPack: Gets a troubleshooting pack or generates an answer file. For example: Get-TroubleshootingPack -Path “C:\Windows\Diagnostics\System\Networking”

Get-TroubleshootingPack Windowsupdate

5. Get-ChildItem: list all directories and files with information in the current directory. For example,

5. Test-NetConnection: You may use ping or telnet to test a host connection. With PowerShell Test-NetConnection , you can a specific port on a machine and route tracing.

6. Get-aduser: List All Users Password Expiration Date. For example,

get-aduser -filter * -properties passwordlastset, passwordneverexpires |ft Name, passwordlastset, Passwordneverexpires
Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" |
Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}

Published by

Bob Lin

Bob Lin, Chicagotech-MVP, MCSE & CNE Data recovery, Windows OS Recovery, Networking, and Computer Troubleshooting on http://www.ChicagoTech.net How to Install and Configure Windows, VMware, Virtualization and Cisco on http://www.HowToNetworking.com