# Remotely scan disk

## Scripts allow to remotely start or schedule Scan Disk. It uses the built-in scan disk function, along with its all functionality – Fixerrors, VigorousIndexCheck, RecoverBadSectors, etc… Code check active directory to get computer object also you can specify computer manually

5 Star
(6)
4,096 times
Storage
3/31/2017
• Not working on new systems?
2 Posts | Last post Thu 11:10 PM
• When trying to run it in Windows 10 or Windows Server 2012 R2 it shows the following error:
At C:\Start-Chkdsk.ps1:169 char:27
+                             $wql = "DeviceID='($_:)'"
+                                                ~~~
Variable reference is not valid. ':' was not followed by a valid variable name character. Consider using ${} to delimit the name. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : InvalidVariableReferenceWithDrive What would need to be changed? When removing that line it won't show an error but no indication that chkdsk really ran either. • Hello Sir. To answer your question and to resolve your issue, open the script, go to line 169, which reads as follows:$wql = "DeviceID='$_:'" And change it to this:$wql = "DeviceID='\$_':"
All you have to do is move the colon outside the single quotation mark and it works like a charm.  Don't forget to dot source it into your current powershell session:
. "Path\to\script\Start-Chkdsk.ps1"
• No output from script
3 Posts | Last post October 16, 2012
• When I run this script I get no output regardless of arguments.  It immediately returns me to powershell prompt.  I've run on desktop and server.  Ideas?

I even put a write-verbose line before and after the Begin{} but i get no output.
• Got it working.  Had to run...
. .\Start-chkdsk.ps1
Then I could use...
start-chkdsk

Using ".\Start-Chkdsk.ps1" alone does nothing.
• Hi,
Ps1 file contain only definition of function.
First you must load it – with dot operator before. And next you must call this function to start scan.

Regards
Michal