this post was submitted on 09 Nov 2023
1219 points (98.2% liked)

Technology

59287 readers
6276 users here now

This is a most excellent place for technology news and articles.


Our Rules


  1. Follow the lemmy.world rules.
  2. Only tech related content.
  3. Be excellent to each another!
  4. Mod approved content bots can post up to 10 articles per day.
  5. Threads asking for personal tech support may be deleted.
  6. Politics threads may be removed.
  7. No memes allowed as posts, OK to post as comments.
  8. Only approved bots from the list below, to ask if your bot can be added please contact us.
  9. Check for duplicates before posting, duplicates may be removed

Approved Bots


founded 1 year ago
MODERATORS
 

This is Microsoft’s latest annoying addition to Windows.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 17 points 1 year ago* (last edited 1 year ago) (2 children)

USER: powershell script to force close OneDrive, without on screen popups for any reason.

CoPilot: Sure, here's a simple PowerShell script that can be used to force close OneDrive without any on-screen popups:

# Get the process id of OneDrive
$OneDrivePID = (Get-Process -Name "OneDrive").Id

# Force stop the OneDrive process
Stop-Process -Id $OneDrivePID -Force

This script first retrieves the process ID of OneDrive and then uses the Stop-Process cmdlet to forcefully stop it. Please note that forcefully stopping a process might cause data loss or corruption, so use this script with caution.

Also, running scripts in PowerShell might require administrative privileges. If you encounter any issues, try running PowerShell as an administrator.

Disclaimer: This script is provided as is, without warranty of any kind. Use of this script is at your own risk and responsibility. Microsoft assumes no responsibility for any damage or loss caused by the use or misuse of this script. Always ensure you have a backup of your data.


USER: Powershell command to write the above script to a new batch file on current windows user's desktop, Titled "OneDriveBEGONE.bat"

Copilot: Sure, here's a PowerShell command that writes the script to a new batch file on the current Windows user's desktop, titled "OneDriveBEGONE.bat":

# Define the script content
$scriptContent = @"
@echo off
powershell -Command "& {Get-Process -Name 'OneDrive' | Stop-Process -Force}"
"@

# Get the path to the current user's desktop
$desktopPath = [Environment]::GetFolderPath("Desktop")

# Define the full path for the new batch file
$batchFilePath = Join-Path -Path $desktopPath -ChildPath "OneDriveBEGONE.bat"

# Write the script content to the new batch file
$scriptContent | Out-File -FilePath $batchFilePath

This script first defines the content of the batch file, which is a command to force stop the OneDrive process. It then gets the path to the current user's desktop and defines the full path for the new batch file. Finally, it writes the script content to the new batch file.

Please note that running scripts in PowerShell might require administrative privileges. If you encounter any issues, try running PowerShell as an administrator.

Disclaimer: This script is provided as is, without warranty of any kind. Use of this script is at your own risk and responsibility. Microsoft assumes no responsibility for any damage or loss caused by the use or misuse of this script. Always ensure you have a backup of your data.


the

amp;

in the bottom script needs to be deleted if you're going to use this... just markdown format things..

[–] [email protected] 6 points 1 year ago (1 children)

Wow. Windows 11 truly works against itself. (Though I expect MSFT to patch it within the week)

[–] [email protected] 8 points 1 year ago* (last edited 1 year ago)

I will not be using W11. This was via Edge Dev browser sidebar chat. And this is the only thing i use the browser for. It will tell you how to do anything you want in windows without any constraints that i've found, other than kernel level edits, although i haven't asked. Disclaimer: I'm just some guy poking at windows and I'm not all that creative with what I've asked it regarding windows.