Skip to content

Instantly share code, notes, and snippets.

@joshjavier
Last active March 24, 2022 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshjavier/045d7ec118dea2aabed3ca24c80e0072 to your computer and use it in GitHub Desktop.
Save joshjavier/045d7ec118dea2aabed3ca24c80e0072 to your computer and use it in GitHub Desktop.
PowerShell script for cleaning up Parsec files
# Import a custom function to retry deleting a folder in case it's still locked
Invoke-Expression -Command (New-Object Net.WebClient).DownloadString("https://gist.github.com/PrateekKumarSingh/65afe12a3fda5ef9ba42bf0673026728/raw/423d55256c185b8f5be819b2e1ef1aa2391fad2e/Retry-Command.ps1")
# Clean up Parsec files
$ParsecDir = "$HOME\Downloads\parsec-portable"
$ParsecShortcut = "$HOME\Desktop\Parsec.lnk"
Stop-Process -Name "parsecd"
Retry-Command -ScriptBlock {Remove-Item $ParsecDir -Recurse} -TimeoutInSecs 3 -Verbose
Remove-Item $ParsecShortcut -ErrorAction Ignore
# Close PowerShell
Write-Host -NoNewLine "Removed all Parsec files. Press any key to exit..."
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Stop-Process -Id $PID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment