Skip to content

Instantly share code, notes, and snippets.

@dotps1
Created November 27, 2016 21:16
Show Gist options
  • Save dotps1/1f7c44a51585ff52f28e29ea36db0a3e to your computer and use it in GitHub Desktop.
Save dotps1/1f7c44a51585ff52f28e29ea36db0a3e to your computer and use it in GitHub Desktop.
This will remove all the folders to allow you to log back into battle.net.
#requires -RunAsAdministrator
<#
.SYNOPSIS
This will remove all the folders to allow you to log back into battle.net.
.DESCRIPTION
This will remove all the folders to allow you to log back into battle.net.
.INPUTS
None
.OUTPUTS
None
.EXAMPLE
PS C:\> . .\BattleNetClientFix.ps1
.NOTES
You will need to re auth after this is run, so if you have an authenticator method bound to your account, you will need that.
And you will need to repoint the app to where your installed games are.
Admin rights are needed as this will force end processes and delete directories.
.LINK
https://dotps1.github.io
.LINK
http://us.battle.net/forums/en/bnet/topic/20752075014?page=1
#>
$processes = @(
"Agent"
"Battle.net",
"Battle.net Helper"
)
foreach ($process in $processes) {
if (Get-Process -Name $process -ErrorAction SilentlyContinue) {
Stop-Process -Name $process -Force
# Test is process is still running.
while (Get-Process -Name $process -ErrorAction SilentlyContinue) {
Start-Sleep -Seconds 1
}
}
}
# Folder names of battle.net shit.
$folders = @(
"Battle.net",
"Blizzard Entertainment"
)
# Places where those folders may exist.
$folderLocations = @(
$env:APPDATA,
$env:LOCALAPPDATA,
$env:ProgramData
)
# loop through each location, if the folder exists in the location, delete it.
foreach ($folderLocation in $folderLocations) {
foreach ($folder in $folders) {
$target = Join-Path -Path $folderLocation -ChildPath $folder
if (Test-Path -Path $target) {
Remove-Item -Path $target -Confirm:$false -Recurse -Force
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment