|
@@ -476,10 +476,10 @@ $RemoveAllBloatware.Add_Click( {
|
|
|
Function CheckInstallService {
|
|
|
|
|
|
If (Get-Service -Name InstallService | Where-Object {$_.Status -eq "Stopped"}) {
|
|
|
- Start-Service -Name InstallService
|
|
|
- Set-Service -Name InstallService -StartupType Automatic
|
|
|
- }
|
|
|
- }
|
|
|
+ Start-Service -Name InstallService
|
|
|
+ Set-Service -Name InstallService -StartupType Automatic
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
Write-Host "Initiating Sysprep"
|
|
|
Begin-SysPrep
|
|
@@ -1151,6 +1151,36 @@ $RemoveRegkeys.Add_Click( {
|
|
|
Write-Host "Additional bloatware keys have been removed! `n"
|
|
|
})
|
|
|
$RemoveOnedrive.Add_Click( {
|
|
|
+ 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-Host "Uninstalling OneDrive. Please wait..."
|
|
|
|
|
|
New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
|