From cddc9fe04e885130ba946d4b5af2fc5462a8eb8a Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Wed, 16 Jun 2021 20:12:40 -0400 Subject: [PATCH] getting rid of cimsession --- disk_check.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/disk_check.ps1 b/disk_check.ps1 index b7f3e80..719faed 100644 --- a/disk_check.ps1 +++ b/disk_check.ps1 @@ -8,7 +8,6 @@ $logFile="C:\ACS\disk_check.log" $computerName='localhost' -$cimSession=New-PSSession $computerName $rebootTime=Get-Date "1:00" $requireReboot=$false $volumes=Get-Volumes -CimSession $cimSession @@ -20,10 +19,10 @@ Function Write-Log{ } foreach ($i in $volumes) { - $result=Repair-Volume -CimSession $cimSession -FileSystemLabel $v.FileSystemLabel -Scan + $result=Repair-Volume -FileSystemLabel $v.FileSystemLabel -Scan if ($result.value -gt 0) { - Repair-Volume -CimSession $cimSession -FileSystemLabel $v.FileSystemLabel -Scan -OfflineScanAndFix + Repair-Volume -FileSystemLabel $v.FileSystemLabel -Scan -OfflineScanAndFix $requireReboot = $true } else { Write-Output "$(v.FileSystemLabel): Drive is OK!"