Skip to content

Add Remove-And-Block-OneDrive.ps1 - #1

Open
Ryan-Adams57 wants to merge 1 commit into
mainfrom
add-remove-and-block-onedrive
Open

Ryan-Adams57 wants to merge 1 commit into
mainfrom
add-remove-and-block-onedrive

Conversation

@Ryan-Adams57

Copy link
Copy Markdown
Owner

Adds Remove-And-Block-OneDrive.ps1.

What it does

  • Uninstalls OneDrive for the current user (runs every OneDriveSetup.exe /uninstall it finds).
  • Removes OneDrive scheduled tasks, HKCU Run auto-start values, the File Explorer namespace icon, and cache/data folders. Leaves %UserProfile%\OneDrive in place if it contains files.
  • Writes the permanent machine-wide block: DisableFileSyncNGSC=1 and DisableFileSync=1 under HKLM Policies.
  • Strips the OneDriveSetup stub from the Default user hive so new profiles never auto-install it.
  • Installs a boot-time SYSTEM task Reassert-OneDrive-Block that re-writes the policy after feature updates, and hardens the C:\Scripts ACL.

Notes

  • Windows Update is NOT disabled; the script only blocks OneDrive re-installation.
  • #Requires -Version 5.1, self-elevating, -WhatIf supported with honest preview labeling.
  • Matches the repo flat layout and Pascal-Case-With-Hyphens naming.

Generated by Claude Code

Self-elevating script that uninstalls OneDrive, removes its data and
Explorer integration, and sets a permanent machine-wide policy block
(DisableFileSyncNGSC) so feature updates cannot re-install it. Includes
a boot-time SYSTEM re-assert task and C:\Scripts ACL hardening.
Supports -WhatIf.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VRz9qGKERixp7M3g67bph
Copilot AI balanced review requested due to automatic review settings November 22, 2026 06:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants