cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
PeterJG
Champion Sweeper II

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)

7 REPLIES 7
zblack
Engaged Sweeper III
Awesome! I'll give this a try. Thanks!
PeterJG
Champion Sweeper II
i've used online encoder tool @ https://raikia.com/tool-powershell-encoder/ to convert powershell to cmd single line
PeterJG
Champion Sweeper II
Shortened script to bare minimum because of LS command box limit of 1000 characters


$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

powershell.exe -exec bypass -enc JABBAHAAcABzAEwAaQBzAHQAIAA9ACAAJwBTAHAAbwB0AGkAZgB5AEEAQgAuAFMAcABvAHQAaQBmAHkATQB1AHMAaQBjACcADQAKAEYAbwByAEUAYQBjAGgAIAAoACQAQQBwAHAAIABpAG4AIAAkAEEAcABwAHMATABpAHMAdAApAHsADQAKACAAIAAgACAAJABQAGEAYwBrAGEAZwBlAEYAdQBsAGwATgBhAG0AZQAgAD0AIAAoAEcAZQB0AC0AQQBwAHAAeABQAGEAYwBrAGEAZwBlACAAJABBAHAAcAApAC4AUABhAGMAawBhAGcAZQBGAHUAbABsAE4AYQBtAGUADQAKACAAIAAgACAAJABQAHIAbwBQAGEAYwBrAGEAZwBlAEYAdQBsAGwATgBhAG0AZQAgAD0AIAAoAEcAZQB0AC0AQQBwAHAAeABQAHIAbwB2AGkAcwBpAG8AbgBlAGQAUABhAGMAawBhAGcAZQAgAC0AbwBuAGwAaQBuAGUAIAB8ACAAdwBoAGUAcgBlACAAewAkAF8ALgBEAGkAcwBwAGwAYQB5AG4AYQBtAGUAIAAtAGUAcQAgACQAQQBwAHAAfQApAC4AUABhAGMAawBhAGcAZQBOAGEAbQBlAA0ACgAgACAAIAAgAGkAZgAgACgAJABQAGEAYwBrAGEAZwBlAEYAdQBsAGwATgBhAG0AZQApAHsADQAKACAAIAAgACAAIAAgACAAIABXAHIAaQB0AGUALQBIAG8AcwB0ACAAIgBSAGUAbQBvAHYAaQBuAGcAIABQAGEAYwBrAGEAZwBlADoAIAAkAEEAcABwACIADQAKACAAIAAgACAAIAAgACAAIAByAGUAbQBvAHYAZQAtAEEAcABwAHgAUABhAGMAawBhAGcAZQAgAC0AcABhAGMAawBhAGcAZQAgACQAUABhAGMAawBhAGcAZQBGAHUAbABsAE4AYQBtAGUADQAKAAkAfQAgACAAIAAgAA0ACgB9AA==
PeterJG
Champion Sweeper II
PeterG wrote:
Shortened script to bare minimum because of LS command box limit of 1000 characters


$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

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
PeterJG
Champion Sweeper II
Found Script... that i've encoded to run as command

$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

powersh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sAYQBnAGUAIAAtAHAAYQBjAGsAYQBnAGUAIAAkAFAAYQBjAGsAYQBnAGUARgB1AGwAbABOAGEAbQBlAA0ACgAgACAAIAAgAH0ADQAKACAAIAAgACAAZQBsAHMAZQB7AA0ACgAgACAAIAAgACAAIAAgACAAVwByAGkAdABlAC0ASABvAHMAdAAgACIAVQBuAGEAYgBsAGUAIAB0AG8AIABmAGkAbgBkACAAcABhAGMAawBhAGcAZQA6ACAAJABBAHAAcAAiAA0ACgAgACAAIAAgAH0ADQAKACAAIAAgACAAaQBmACAAKAAkAFAAcgBvAFAAYQBjAGsAYQBnAGUARgB1AGwAbABOAGEAbQBlACkAewANAAoAIAAgACAAIAAgACAAIAAgAFcAcgBpAHQAZQAtAEgAbwBzAHQAIAAiAFIAZQBtAG8AdgBpAG4AZwAgAFAAcgBvAHYAaQBzAGkAbwBuAGUAZAAgAFAAYQBjAGsAYQBnAGUAOgAgACQAUAByAG8AUABhAGMAawBhAGcAZQBGAHUAbABsAE4AYQBtAGUAIgANAAoAIAAgACAAIAAgACAAIAAgAFIAZQBtAG8AdgBlAC0AQQBwAHAAeABQAHIAbwB2AGkAcwBpAG8AbgBlAGQAUABhAGMAawBhAGcAZQAgAC0AbwBuAGwAaQBuAGUAIAAtAHAAYQBjAGsAYQBnAGUAbgBhAG0AZQAgACQAUAByAG8AUABhAGMAawBhAGcAZQBGAHUAbABsAE4AYQBtAGUADQAKACAAIAAgACAAfQANAAoAIAAgACAAIABlAGwAcwBlAHsADQAKACAAIAAgACAAIAAgACAAIABXAHIAaQB0AGUALQBIAG8AcwB0ACAAIgBVAG4AYQBiAGwAZQAgAHQAbwAgAGYAaQBuAGQAIABwAHIAbwB2AGkAcwBpAG8AbgBlAGQAIABwAGEAYwBrAGEAZwBlADoAIAAkAEEAcABwACIADQAKACAAIAAgACAAfQANAAoAfQA=

PeterJG
Champion Sweeper II
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

zblack
Engaged Sweeper III
PeterG wrote:
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)?