PSSession

This commit is contained in:
Wyatt J. Miller 2021-06-16 20:09:49 -04:00
parent 2b322ae062
commit 0f1f190258

View File

@ -8,7 +8,7 @@
$logFile="C:\ACS\disk_check.log" $logFile="C:\ACS\disk_check.log"
$computerName='localhost' $computerName='localhost'
$cimSession=New-Session $computerName $cimSession=New-PSSession $computerName
$rebootTime=Get-Date "1:00" $rebootTime=Get-Date "1:00"
$requireReboot=$false $requireReboot=$false
$volumes=Get-Volumes -CimSession $cimSession $volumes=Get-Volumes -CimSession $cimSession
@ -20,7 +20,7 @@ Function Write-Log{
} }
foreach ($i in $volumes) { foreach ($i in $volumes) {
$result=Repair-Volumes -CimSession $cimSession -FileSystemLabel $v.FileSystemLabel -Scan $result=Repair-Volume -CimSession $cimSession -FileSystemLabel $v.FileSystemLabel -Scan
if ($result.value -gt 0) { if ($result.value -gt 0) {
Repair-Volume -CimSession $cimSession -FileSystemLabel $v.FileSystemLabel -Scan -OfflineScanAndFix Repair-Volume -CimSession $cimSession -FileSystemLabel $v.FileSystemLabel -Scan -OfflineScanAndFix