Petrov,
Here's a writeup on running a PowerShell script
and then the script itself which is nice.
The script puts a file on your desktop.
Attach the file to your next post.
# **********************INSTRUCTIONS**************************
# STEP 1 *****************************************************
# RUN
PowerShell as administrator
# Here is how:
# WIN key | type POWERSHELL | do NOT hit ENTER |
# in the resulting PROGRAMS list, right-click on WINDOWS POWERSHELL |
# choose "Run as administrator" from the resulting list
# Click on the YES button (if such appears)
#
# WIN key = key with Microsoft log on top
# for the guru:
# WIN key | type POWERSHELL | CTRL+SHIFT+ENTER key combo | ALT+Y keycombo
# ************************************************************
# STEP 2 *****************************************************
# COPY, using CTRL+C, every line of script down thru both EXIT statements
# PASTE into Powershell
#----Right-Click at the PowerShell Prompt
#----(Ctrl+V does not work)
# Start copying with first line without a # at start of the line
# Note: Actually, you can paste the entire file if you rather
#-------Lines starting with a # are ignored by PowerShell
# ************************************************************
# ***************** NOTE - POWERSHELL VERSION*****************
# if you receive this error msg:
#--Get-WinEvent: The system can not find the path specified
# you need to update your PowerShell
# you must be using Powershell 2.0 or later.
#
# To determine your Powershell version:
#---Run PowerShell
#---enter $host.version
#---you should see at least:
# Major Minor Build Revision
# ----- ----- ----- --------
# 2......0......-1.....-1
#
# If you do not see the above, update your Vista/Win 7.
# ************************************************************
# *************** NOTE - EXECUTION POLICY*********************
# If you haven't set the execution policy, you may need to:
#---Run PowerShell
#---enter Set-ExecutionPolicy -executionpolicy remotesigned
# ************************************************************
====================================================
==================================================
And here is the mighty script:
Script:
# ************************************************************
# Places CHKDSKLOGS.txt on your DESKTOP
#
# Results of running chkdsk (check disk) are in ChkDskLogs.txt
# ************************************************************
$events = get-winevent -filterhashtable @{logname='application';id=1001,26212,26214} -verbose:$false -ea:silentlycontinue |
sort-object -property timecreated -desc |
where {($_.providername -ne 'Microsoft-Windows-LoadPerf') -and ($_.providername -ne 'Windows Error Reporting')}
If ($events -eq $Null) {"No check disk logs exist." | OUT-FILE $env:userprofile\desktop\CHKDSKLOGS.TXT} ELSE {
$events | SELECT timecreated, id, message |
format-table -auto -wrap | OUT-FILE $env:userprofile\desktop\CHKDSKLOGS.TXT }
EXIT
EXIT
# ************************************************************
======================================
karl