Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 34890

PowerTip: Use PowerShell to Troubleshoot PowerShell

$
0
0

Summary: Use Windows PowerShell to troubleshoot errors with Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to troubleshoot issues with Windows PowerShell?

Hey, Scripting Guy! Answer Use the Get-WinEvent cmdlet to parse the Windows PowerShell log. For example, to find all errors in a Windows PowerShell log:

In Windows PowerShell 3.0:

Get-WinEvent -LogName *powershell* | where leveldisplayname -eq 'error'

In Windows PowerShell 2.0:

Get-WinEvent -LogName *powershell* | where {$_.LevelDisplayName -eq 'error'}

You can also group by the error ID to get an idea of how often a particular error appears:

In Windows PowerShell 3.0:

Get-WinEvent -LogName *powershell* | where leveldisplayname -eq 'error' | group id

In Windows PowerShell 2.0:

Get-WinEvent -LogName *powershell* | where {$_.LevelDisplayName -eq 'error'} | group id

 


Viewing all articles
Browse latest Browse all 34890

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>