fleschutz / PowerShell

500+ PowerShell scripts (.ps1) for every system!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

an error in query-smart-data.ps1

OlegBoul opened this issue · comments

you need to change $DevInfo++ onto $DevNo
in $DevInfo++
at line 54, wrong:
[int]$DevNo = 1
foreach($Device in $Devices) {
write-output "(3) Querying data from S.M.A.R.T. device $Device..."

	$Time = (Get-Date)
	$Filename = "$Directory/SMART-dev$($DevNo)-$($Time.Year)-$($Time.Month)-$($Time.Day).json"
	write-output "(4) Saving data to $Filename..."

	$Cmd = "smartctl --all --json " + $Device 

	Invoke-Expression $Cmd > $Filename
	$DevInfo++
}

right:
[int]$DevNo = 1
foreach($Device in $Devices) {
write-output "(3) Querying data from S.M.A.R.T. device $Device..."

	$Time = (Get-Date)
	$Filename = "$Directory/SMART-dev$($DevNo)-$($Time.Year)-$($Time.Month)-$($Time.Day).json"
	write-output "(4) Saving data to $Filename..."

	$Cmd = "smartctl --all --json " + $Device 

	Invoke-Expression $Cmd > $Filename
	$DevNo++
}

Should be fixed now. Thank you very much for the hint.

Issue is closed now.