mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-04-15 17:58:31 +00:00
Removed onedrivesetup removal from Invoke-WinUtilISOScript.ps1 (#4350)
* Removed onedrivesetup removal Invoke-WinUtilISOScript.ps1 * Added OneDrive removal to autounattend.xml
This commit is contained in:
@@ -169,13 +169,7 @@ function Invoke-WinUtilISOScript {
|
|||||||
& $Log "Driver injection skipped."
|
& $Log "Driver injection skipped."
|
||||||
}
|
}
|
||||||
|
|
||||||
# ── 3. Remove OneDrive ────────────────────────────────────────────────────
|
# ── 3. Registry tweaks ────────────────────────────────────────────────────
|
||||||
& $Log "Removing OneDrive..."
|
|
||||||
& takeown /f "$ScratchDir\Windows\System32\OneDriveSetup.exe" | Out-Null
|
|
||||||
& icacls "$ScratchDir\Windows\System32\OneDriveSetup.exe" /grant "$($adminGroup.Value):(F)" /T /C | Out-Null
|
|
||||||
Remove-Item -Path "$ScratchDir\Windows\System32\OneDriveSetup.exe" -Force -ErrorAction SilentlyContinue
|
|
||||||
|
|
||||||
# ── 4. Registry tweaks ────────────────────────────────────────────────────
|
|
||||||
& $Log "Loading offline registry hives..."
|
& $Log "Loading offline registry hives..."
|
||||||
reg load HKLM\zCOMPONENTS "$ScratchDir\Windows\System32\config\COMPONENTS"
|
reg load HKLM\zCOMPONENTS "$ScratchDir\Windows\System32\config\COMPONENTS"
|
||||||
reg load HKLM\zDEFAULT "$ScratchDir\Windows\System32\config\default"
|
reg load HKLM\zDEFAULT "$ScratchDir\Windows\System32\config\default"
|
||||||
@@ -329,7 +323,7 @@ function Invoke-WinUtilISOScript {
|
|||||||
reg unload HKLM\zSOFTWARE
|
reg unload HKLM\zSOFTWARE
|
||||||
reg unload HKLM\zSYSTEM
|
reg unload HKLM\zSYSTEM
|
||||||
|
|
||||||
# ── 5. Delete scheduled task definition files ─────────────────────────────
|
# ── 4. Delete scheduled task definition files ─────────────────────────────
|
||||||
& $Log "Deleting scheduled task definition files..."
|
& $Log "Deleting scheduled task definition files..."
|
||||||
$tasksPath = "$ScratchDir\Windows\System32\Tasks"
|
$tasksPath = "$ScratchDir\Windows\System32\Tasks"
|
||||||
Remove-Item "$tasksPath\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" -Force -ErrorAction SilentlyContinue
|
Remove-Item "$tasksPath\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" -Force -ErrorAction SilentlyContinue
|
||||||
@@ -345,7 +339,7 @@ function Invoke-WinUtilISOScript {
|
|||||||
Remove-Item "$tasksPath\Microsoft\WindowsUpdate" -Recurse -Force -ErrorAction SilentlyContinue
|
Remove-Item "$tasksPath\Microsoft\WindowsUpdate" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
& $Log "Scheduled task files deleted."
|
& $Log "Scheduled task files deleted."
|
||||||
|
|
||||||
# ── 6. Remove ISO support folder ─────────────────────────────────────────
|
# ── 5. Remove ISO support folder ─────────────────────────────────────────
|
||||||
if ($ISOContentsDir -and (Test-Path $ISOContentsDir)) {
|
if ($ISOContentsDir -and (Test-Path $ISOContentsDir)) {
|
||||||
& $Log "Removing ISO support\ folder..."
|
& $Log "Removing ISO support\ folder..."
|
||||||
Remove-Item -Path (Join-Path $ISOContentsDir "support") -Recurse -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path (Join-Path $ISOContentsDir "support") -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
|||||||
@@ -459,6 +459,9 @@ $scripts = @(
|
|||||||
Start-Process -FilePath (Join-Path $viveDir 'ViVeTool.exe') -ArgumentList '/disable /id:47205210' -Wait -NoNewWindow;
|
Start-Process -FilePath (Join-Path $viveDir 'ViVeTool.exe') -ArgumentList '/disable /id:47205210' -Wait -NoNewWindow;
|
||||||
Remove-Item -Path $viveDir -Recurse -Force;
|
Remove-Item -Path $viveDir -Recurse -Force;
|
||||||
};
|
};
|
||||||
|
{
|
||||||
|
Start-Process C:\Windows\System32\OneDriveSetup.exe -ArgumentList /uninstall
|
||||||
|
};
|
||||||
{
|
{
|
||||||
if( (Get-BitLockerVolume -MountPoint $Env:SystemDrive).ProtectionStatus -eq 'On' ) {
|
if( (Get-BitLockerVolume -MountPoint $Env:SystemDrive).ProtectionStatus -eq 'On' ) {
|
||||||
Disable-BitLocker -MountPoint $Env:SystemDrive;
|
Disable-BitLocker -MountPoint $Env:SystemDrive;
|
||||||
|
|||||||
Reference in New Issue
Block a user