Skip to content

Commit 5eba36b

Browse files
authored
Add files via upload
1 parent 1d383a8 commit 5eba36b

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

Maintenance/Repair-AllVolumes.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
function Get-FixedVolume {
2+
Get-Volume | Where-Object DriveType -EQ Fixed | Sort-Object DriveLetter
3+
}
4+
5+
$Volumes = Get-FixedVolume
6+
foreach ($Volume in $Volumes) {
7+
Format-List -InputObject $Volume -Property DriveLetter,Path,UniqueID,FileSystemLabel,FileSystemType,Size,SizeRemaining
8+
$Volume | Repair-Volume -Scan -Verbose
9+
}
10+
Get-FixedVolume

Maintenance/Repair-Windows.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
$CurrentFolder = Split-Path $PSCommandPath
2+
Push-Location $CurrentFolder
3+
4+
$ErrorActionPreference = "Stop"
5+
$InformationPreference = "Continue"
6+
7+
try {
8+
Write-Information "Starting stage 1, DISM"
9+
Write-Information $(Get-Date)
10+
Import-Module -Name Dism
11+
Repair-WindowsImage -Online -RestoreHealth -LogPath $(Join-Path -Path $CurrentFolder -ChildPath 'DISM.log')
12+
13+
Write-Information "Starting stage 2, SFC"
14+
Write-Information $(Get-Date)
15+
sfc.exe /ScanNow
16+
$CbsLogFull = Join-Path -Path $env:windir -ChildPath "logs\cbs\cbs.log"
17+
Copy-Item -Path $CbsLogFull -Destination $CurrentFolder
18+
}
19+
finally {
20+
Pop-Location
21+
}

0 commit comments

Comments
 (0)