Notification

Icon
Error

Kills/Removes Spotify on XP or Win7

Posted: Thursday, March 19, 2015 8:00:00 PM(UTC)
PeterG

PeterG

Member Original PosterPosts: 97
3
Like
Something I have put together to combat the dreadful spotify plague our network is having issues with. This will delete spotify from user pc and remove links for it. Last step is to run LSPUSH to send updated inventory back to server (you can modify it)
Spotify KillDownload Package
Description
Final ActionNothing
Max. Duration15 min(s), 0 hour(s)
RescanNo
Steps
1. kill Spotify.exe
TypeKill Process
Return Codes 0,1641,3010
SuccessGo To Next
FailureGo To Next
Command taskkill /im spotify.exe /f /t
2. kill SpotifyWebHelper.exe
TypeKill Process
Return Codes 0,1641,3010
SuccessGo To Next
FailureGo To Next
Command taskkill /im SpotifyWebHelper.exe /f /t
3. kill SpotifyLauncher.exe
TypeKill Process
Return Codes 0,1641,3010
SuccessGo To Next
FailureGo To Next
Command taskkill /im SpotifyLauncher.exe /f /t
4. Check for Windows 7
TypeCondition
SuccessGo To Step 6
FailureGo To Next
Conditions
Registry HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion ProductName Has Value Windows 7 Professional
5. Check if XP
TypeCondition
SuccessGo To Step 9
FailureGo To Step 4
Conditions
Registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion ProductName Has Not Value Windows 7 Professional
6. Delete Spotify Folder - win7
TypeCommand
Return Codes 0,1641,3010
SuccessGo To Next
FailureGo To Next
Command for /d /r c:\users %d in (spotify) do @if exist "%d" rd /s /q "%d"
7. Delete SpotifySetup - win7
TypeCommand
Return Codes 0,1641,3010
SuccessGo To Next
FailureGo To Next
Command for /r c:\users %d in (spotifysetup*.exe) do @if exist "%d" del /q /f "%d"
8. Delete Spotify Link - Win7
TypeCommand
Return Codes 0,1641,3010
SuccessGo To Step 12
FailureGo To Step 12
Command for /r c:\users %d in (spotify*.lnk) do @if exist "%d" del /q /f "%d"
9. Delete Spotify Folder - XP
TypeCommand
Return Codes 0,1641,3010
SuccessGo To Next
FailureGo To Next
Command for /d /r "c:\documents and settings" %d in (spotify) do @if exist "%d" rd /s /q "%d"
10. Delete Spotify Link - XP
TypeCommand
Return Codes 0,1641,3010
SuccessGo To Next
FailureGo To Next
Command for /r "c:\documents and settings" %d in (spotify*.lnk) do @if exist "%d" del /q /f "%d"
11. Delete Spotify Setup - XP
TypeCommand
Return Codes 0,1641,3010
SuccessGo To Next
FailureGo To Next
Command for /r "c:\documents and settings" %d in (spotifysetup*.exe) do @if exist "%d" del /q /f "%d"
12. Run LsPush
TypeCommand
Return Codes 0,1641,3010
SuccessStop (Success)
FailureStop (Failure)
Command %systemroot%\LsPush\lspush.exe LS_Server 9524
zbwalker
#1zbwalker Member Posts: 11  
posted: 5/6/2019 3:26:48 PM(UTC)
Originally Posted by: PeterG Go to Quoted Post
Something I have put together to combat the dreadful spotify plague our network is having issues with. This will delete spotify from user pc and remove links for it. Last step is to run LSPUSH to send updated inventory back to server (you can modify it)


Does anyone have a version of this that works on the latest Spotify and Windows 10 (including 7 but excluding XP)?
PeterG
#2PeterG Member Original PosterPosts: 97  
posted: 5/6/2019 4:40:18 PM(UTC)
The Win10 Command to remove Windows Store Applications is powershell based.. so if we can get that into batch format.. that would take care of that. The Non Windows Store Setup works same as Win7 and puts files in Appdata/Roming/Spotify directory..


Powersell command is

PS C:> Get-AppxPackage SpotifyAB.SpotifyMusic | Remove-AppxPackage


i'm thinking batch would be

Powershell.exe -command { Get-AppxPackage *Spotify* | Remove-AppxPackage } but its not working.. so maybe powershell guru can help us

PeterG
#3PeterG Member Original PosterPosts: 97  
posted: 5/6/2019 4:56:57 PM(UTC)
Found Script... that i've encoded to run as command

Code:
$AppsList = 'SpotifyAB.SpotifyMusic'

ForEach ($App in $AppsList){
    $PackageFullName = (Get-AppxPackage $App).PackageFullName
    $ProPackageFullName = (Get-AppxProvisionedPackage -online | where {$_.Displayname -eq $App}).PackageName
    write-host $PackageFullName
    Write-Host $ProPackageFullName
    if ($PackageFullName){
        Write-Host "Removing Package: $App"
        remove-AppxPackage -package $PackageFullName
    }
    else{
        Write-Host "Unable to find package: $App"
    }
    if ($ProPackageFullName){
        Write-Host "Removing Provisioned Package: $ProPackageFullName"
        Remove-AppxProvisionedPackage -online -packagename $ProPackageFullName
    }
    else{
        Write-Host "Unable to find provisioned package: $App"
    }
}


and encoded command line would be

Code:
powershell.exe -exec bypass -enc JABBAHAAcABzAEwAaQBzAHQAIAA9ACAAJwBTAHAAbwB0AGkAZgB5AEEAQgAuAFMAcABvAHQAaQBmAHkATQB1AHMAaQBjACcADQAKAA0ACgBGAG8AcgBFAGEAYwBoACAAKAAkAEEAcABwACAAaQBuACAAJABBAHAAcABzAEwAaQBzAHQAKQB7AA0ACgAgACAAIAAgACQAUABhAGMAawBhAGcAZQBGAHUAbABsAE4AYQBtAGUAIAA9ACAAKABHAGUAdAAtAEEAcABwAHgAUABhAGMAawBhAGcAZQAgACQAQQBwAHAAKQAuAFAAYQBjAGsAYQBnAGUARgB1AGwAbABOAGEAbQBlAA0ACgAgACAAIAAgACQAUAByAG8AUABhAGMAawBhAGcAZQBGAHUAbABsAE4AYQBtAGUAIAA9ACAAKABHAGUAdAAtAEEAcABwAHgAUAByAG8AdgBpAHMAaQBvAG4AZQBkAFAAYQBjAGsAYQBnAGUAIAAtAG8AbgBsAGkAbgBlACAAfAAgAHcAaABlAHIAZQAgAHsAJABfAC4ARABpAHMAcABsAGEAeQBuAGEAbQBlACAALQBlAHEAIAAkAEEAcABwAH0AKQAuAFAAYQBjAGsAYQBnAGUATgBhAG0AZQANAAoAIAAgACAAIAB3AHIAaQB0AGUALQBoAG8AcwB0ACAAJABQAGEAYwBrAGEAZwBlAEYAdQBsAGwATgBhAG0AZQANAAoAIAAgACAAIABXAHIAaQB0AGUALQBIAG8AcwB0ACAAJABQAHIAbwBQAGEAYwBrAGEAZwBlAEYAdQBsAGwATgBhAG0AZQANAAoAIAAgACAAIABpAGYAIAAoACQAUABhAGMAawBhAGcAZQBGAHUAbABsAE4AYQBtAGUAKQB7AA0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AIABwAHIAbwB2AGkAcwBpAG8AbgBlAGQAIABwAGEAYwBrAGEAZwBlADoAIAAkAEEAcABwACIADQAKACAAIAAgACAAfQANAAoAfQA=

PeterG
#4PeterG Member Original PosterPosts: 97  
posted: 5/6/2019 5:11:04 PM(UTC)
Shortened script to bare minimum because of LS command box limit of 1000 characters

Code:

$AppsList = 'SpotifyAB.SpotifyMusic'
ForEach ($App in $AppsList){
    $PackageFullName = (Get-AppxPackage $App).PackageFullName
    $ProPackageFullName = (Get-AppxProvisionedPackage -online | where {$_.Displayname -eq $App}).PackageName
    if ($PackageFullName){
        remove-AppxPackage -package $PackageFullName
	}    
}


encoded into single line command

Code:
powershell.exe -exec bypass -enc JABBAHAAcABzAEwAaQBzAHQAIAA9ACAAJwBTAHAAbwB0AGkAZgB5AEEAQgAuAFMAcABvAHQAaQBmAHkATQB1AHMAaQBjACcADQAKAEYAbwByAEUAYQBjAGgAIAAoACQAQQBwAHAAIABpAG4AIAAkAEEAcABwAHMATABpAHMAdAApAHsADQAKACAAIAAgACAAJABQAGEAYwBrAGEAZwBlAEYAdQBsAGwATgBhAG0AZQAgAD0AIAAoAEcAZQB0AC0AQQBwAHAAeABQAGEAYwBrAGEAZwBlACAAJABBAHAAcAApAC4AUABhAGMAawBhAGcAZQBGAHUAbABsAE4AYQBtAGUADQAKACAAIAAgACAAJABQAHIAbwBQAGEAYwBrAGEAZwBlAEYAdQBsAGwATgBhAG0AZQAgAD0AIAAoAEcAZQB0AC0AQQBwAHAAeABQAHIAbwB2AGkAcwBpAG8AbgBlAGQAUABhAGMAawBhAGcAZQAgAC0AbwBuAGwAaQBuAGUAIAB8ACAAdwBoAGUAcgBlACAAewAkAF8ALgBEAGkAcwBwAGwAYQB5AG4AYQBtAGUAIAAtAGUAcQAgACQAQQBwAHAAfQApAC4AUABhAGMAawBhAGcAZQBOAGEAbQBlAA0ACgAgACAAIAAgAGkAZgAgACgAJABQAGEAYwBrAGEAZwBlAEYAdQBsAGwATgBhAG0AZQApAHsADQAKACAAIAAgACAAIAAgACAAIABXAHIAaQB0AGUALQBIAG8AcwB0ACAAIgBSAGUAbQBvAHYAaQBuAGcAIABQAGEAYwBrAGEAZwBlADoAIAAkAEEAcABwACIADQAKACAAIAAgACAAIAAgACAAIAByAGUAbQBvAHYAZQAtAEEAcABwAHgAUABhAGMAawBhAGcAZQAgAC0AcABhAGMAawBhAGcAZQAgACQAUABhAGMAawBhAGcAZQBGAHUAbABsAE4AYQBtAGUADQAKAAkAfQAgACAAIAAgAA0ACgB9AA==
PeterG
#5PeterG Member Original PosterPosts: 97  
posted: 5/6/2019 5:12:47 PM(UTC)
i've used online encoder tool @ https://raikia.com/tool-powershell-encoder/ to convert powershell to cmd single line
Handles attachments
Spotify Kill (win7 & 10).xml.zip (2kb) downloaded 4 time(s).
PeterG
#6PeterG Member Original PosterPosts: 97  
posted: 5/6/2019 6:28:46 PM(UTC)
Originally Posted by: PeterG Go to Quoted Post
Shortened script to bare minimum because of LS command box limit of 1000 characters

Code:

$AppsList = 'SpotifyAB.SpotifyMusic'
ForEach ($App in $AppsList){
    $PackageFullName = (Get-AppxPackage $App).PackageFullName
    $ProPackageFullName = (Get-AppxProvisionedPackage -online | where {$_.Displayname -eq $App}).PackageName
    if ($PackageFullName){
        remove-AppxPackage -package $PackageFullName
	}    
}


encoded into single line command

Code:
powershell.exe -exec bypass -enc JABBAHAAcABzAEwAaQBzAHQAIAA9ACAAJwBTAHAAbwB0AGkAZgB5AEEAQgAuAFMAcABvAHQAaQBmAHkATQB1AHMAaQBjACcADQAKAEYAbwByAEUAYQBjAGgAIAAoACQAQQBwAHAAIABpAG4AIAAkAEEAcABwAHMATABpAHMAdAApAHsADQAKACAAIAAgACAAJABQAGEAYwBrAGEAZwBlAEYAdQBsAGwATgBhAG0AZQAgAD0AIAAoAEcAZQB0AC0AQQBwAHAAeABQAGEAYwBrAGEAZwBlACAAJABBAHAAcAApAC4AUABhAGMAawBhAGcAZQBGAHUAbABsAE4AYQBtAGUADQAKACAAIAAgACAAJABQAHIAbwBQAGEAYwBrAGEAZwBlAEYAdQBsAGwATgBhAG0AZQAgAD0AIAAoAEcAZQB0AC0AQQBwAHAAeABQAHIAbwB2AGkAcwBpAG8AbgBlAGQAUABhAGMAawBhAGcAZQAgAC0AbwBuAGwAaQBuAGUAIAB8ACAAdwBoAGUAcgBlACAAewAkAF8ALgBEAGkAcwBwAGwAYQB5AG4AYQBtAGUAIAAtAGUAcQAgACQAQQBwAHAAfQApAC4AUABhAGMAawBhAGcAZQBOAGEAbQBlAA0ACgAgACAAIAAgAGkAZgAgACgAJABQAGEAYwBrAGEAZwBlAEYAdQBsAGwATgBhAG0AZQApAHsADQAKACAAIAAgACAAIAAgACAAIABXAHIAaQB0AGUALQBIAG8AcwB0ACAAIgBSAGUAbQBvAHYAaQBuAGcAIABQAGEAYwBrAGEAZwBlADoAIAAkAEEAcABwACIADQAKACAAIAAgACAAIAAgACAAIAByAGUAbQBvAHYAZQAtAEEAcABwAHgAUABhAGMAawBhAGcAZQAgAC0AcABhAGMAawBhAGcAZQAgACQAUABhAGMAawBhAGcAZQBGAHUAbABsAE4AYQBtAGUADQAKAAkAfQAgACAAIAAgAA0ACgB9AA==


Add more apps by increasing loop on first line with

$AppsList = 'SpotifyAB.SpotifyMusic', '2nd app', '3rd app'

or

$AppsList = 'SpotifyAB.SpotifyMusic',
'2nd app',
'3rd app' (last line doesn't have comma)

to get names run

Powershell command "Get-AppxPackage | clip" and it will copy them to clipboard.. paste to notepad and 1st line of the package is the name used in script
zbwalker
#7zbwalker Member Posts: 11  
posted: 5/7/2019 5:06:46 PM(UTC)
Awesome! I'll give this a try. Thanks!

Active Discussions

Lansweeper Email attachments
by  krejar   Go to last post Go to first unread
Last post: 8/15/2019 10:15:07 PM(UTC)
Lansweeper HP Printer not showing correctly
by  Fathom  
Go to last post Go to first unread
Last post: 8/15/2019 4:14:55 PM(UTC)
Lansweeper Install LsAgent on Mac
by  Jonnym   Go to last post Go to first unread
Last post: 8/14/2019 10:14:08 AM(UTC)
Lansweeper Asset State Question
by  rtaylor  
Go to last post Go to first unread
Last post: 8/13/2019 5:53:24 PM(UTC)
Lansweeper LSAgent Version
by  roberto.m  
Go to last post Go to first unread
Last post: 8/13/2019 3:33:50 PM(UTC)
Lansweeper Lansweeper and snmp v3
by  Justin5135   Go to last post Go to first unread
Last post: 8/12/2019 7:07:22 PM(UTC)
Lansweeper Hikvision CCTV Cameras SNMP scan
by  thejduk  
Go to last post Go to first unread
Last post: 8/12/2019 2:34:05 PM(UTC)