|
@@ -518,6 +518,36 @@ Function FixWhitelistedApps {
|
|
|
|
|
|
Function UninstallOneDrive {
|
|
|
|
|
|
+ Write-Output "Checking for pre-existing files located in the OneDrive folders..."
|
|
|
+ Start-Sleep 1
|
|
|
+ If (Get-Item -Path "$env:USERPROFILE\OneDrive\*") {
|
|
|
+ Write-Output "Files found within the OneDrive folder! Checking to see if a folder named OneDriveBackupFiles exists."
|
|
|
+ Start-Sleep 1
|
|
|
+
|
|
|
+ If (Get-Item "$env:USERPROFILE\Desktop\OneDriveBackupFiles" -ErrorAction SilentlyContinue) {
|
|
|
+ Write-Output "A folder named OneDriveBackupFiles already exists on your desktop. All files from your OneDrive location will be moved to that folder."
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ If (!(Get-Item "$env:USERPROFILE\Desktop\OneDriveBackupFiles" -ErrorAction SilentlyContinue)) {
|
|
|
+ Write-Output "A folder named OneDriveBackupFiles will be created and will be located on your desktop. All files from your OneDrive location will be located in that folder."
|
|
|
+ New-item -Path "$env:USERPROFILE\Desktop" -Name "OneDriveBackupFiles"-ItemType Directory -Force
|
|
|
+ Write-Output "Successfully created the folder 'OneDriveBackupFiles' on your desktop."
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Start-Sleep 1
|
|
|
+ Move-Item -Path "$env:USERPROFILE\OneDrive\*" -Destination "$env:USERPROFILE\Desktop\OneDriveBackupFiles" -Force
|
|
|
+ Write-Output "Successfully moved all files from your OneDrive folder to the folder 'OneDriveBackupFiles' on your desktop."
|
|
|
+ Start-Sleep 1
|
|
|
+ Write-Output "Proceeding with the removal of OneDrive."
|
|
|
+ Start-Sleep 1
|
|
|
+ }
|
|
|
+ Else {
|
|
|
+ If (!(Get-Item -Path "$env:USERPROFILE\OneDrive\*")) {
|
|
|
+ Write-Output "Either the OneDrive folder does not exist or there are no files to be found in the folder. Proceeding with removal of OneDrive."
|
|
|
+ Start-Sleep 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Write-Output "Uninstalling OneDrive"
|
|
|
|
|
|
New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
|