Skip to content

Commit cdefc58

Browse files
committed
Fix OneDrive removal (#147)
Co-authored-by: 5p3ctra <[email protected]>
1 parent a229321 commit cdefc58

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/scripts/Remove-OneDrive.ps1

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ function Remove-OneDrive() {
2525
}
2626

2727
Write-Host "Disable OneDrive via Group Policies."
28-
Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\OneDrive" "DisableFileSyncNGSC" 1
28+
Set-ItemPropertyVerified -Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\OneDrive" -Name "DisableFileSyncNGSC" -Type DWord -Value 1
2929

3030
Write-Host "Remove Onedrive from explorer sidebar."
31-
New-PSDrive -PSProvider "Registry" -Root "HKEY_CLASSES_ROOT" -Name "HKCR"
31+
New-PSDrive -PSProvider "Registry" -Root "HKEY_CLASSES_ROOT" -Scope Global -Name "HKCR"
3232
mkdir -Force "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
33-
Set-ItemPropertyVerified -Path "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" "System.IsPinnedToNameSpaceTree" 0
33+
Set-ItemPropertyVerified -Path "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Name "System.IsPinnedToNameSpaceTree" -Type DWord -Value 0
3434
mkdir -Force "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
35-
Set-ItemPropertyVerified -Path "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" "System.IsPinnedToNameSpaceTree" 0
35+
Set-ItemPropertyVerified -Path "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Name "System.IsPinnedToNameSpaceTree" -Type DWord -Value 0
3636
Remove-PSDrive "HKCR"
3737

3838
# Thank you Matthew Israelsson
@@ -42,7 +42,7 @@ function Remove-OneDrive() {
4242
reg unload "hku\Default"
4343

4444
Write-Host "Removing startmenu entry..."
45-
Remove-ItemVerified -Force -ErrorAction SilentlyContinue "$env:userprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk"
45+
Remove-ItemVerified -Path "$env:userprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk" -Force -ErrorAction SilentlyContinue
4646

4747
Write-Host "Removing scheduled task..."
4848
Get-ScheduledTask -TaskPath '\' -TaskName 'OneDrive*' -ea SilentlyContinue | Unregister-ScheduledTask -Confirm:$false

0 commit comments

Comments
 (0)