PSSession
This commit is contained in:
parent
2b322ae062
commit
0f1f190258
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user