none
appx deployment service (appxsvc) causing 10 minute logins RRS feed

  • Question

  • Today I saw "appx deployment service (appxsvc), svchost.exe -k wsappx -p" causing about a 10 minute login in windows 10 1703.  It's on a few "kiosk" computers that have a lot of logins.  I know when you delete a profile, a lot of things get left behind, and services like this use more and more resources.  I just wish this would get fixed. 
    • Edited by JS2010 Wednesday, September 19, 2018 2:16 PM
    Wednesday, September 19, 2018 2:16 PM

All replies

  • Hi,

    You may try a Process Monitor boot trace.

    Also refer to the following article and check if it can help you.

    What Is WSAPPX And High CPU Load Solution (Working) With Appx Deployment Service

    http://tech2seeks.com/wsappx/

    Please Note: Since the website is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.

    Best Regards,

    Tao


    Please remember to mark the replies as answers if they help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Thursday, September 20, 2018 3:10 AM
    Moderator
  • Here's the files it's accessing.  Can I set this service to run low priority?  StateRepository-Machine.srd-wal is 542 megs.  StateRepository-Machine.srd is 16 megs.  Maybe I need to uninstall a user's apps before deleting their profile?  This is a recently reimaged machine, but it gets a lot of logins.  I clean the profiles every morning.  What launches this service?  Winver returns "Version 1709 (OS Build 16299.492)".   I might have to disable the Microsoft Store in group policy.  "Read Bytes" for the first 2 files is over a gig, and it's not done yet.

    Read Bytes    Write Bytes Path
    ----------    ----------- ----
    1,437,737,672 0           C:\ProgramData\Microsoft\Windows\AppRepository\StateRepository-Machine.srd
    1,273,921,224 10,255,952  C:\ProgramData\Microsoft\Windows\AppRepository\StateRepository-Machine.srd-wal
    396,326,400   0           C:\ProgramData\Microsoft\Windows\AppRepository\StateRepository-Deployment.srd
    65,536        0           C:\ProgramData\Microsoft\Windows\AppRepository\StateRepository-Machine.srd-shm
    618,496       0           C:\ProgramData\Microsoft\Windows\AppRepository\StateRepository-Deployment.srd-shm
    659,792       749,464     C:\ProgramData\Microsoft\Windows\AppRepository\StateRepository-Deployment.srd-wal

    • Edited by JS2010 Wednesday, September 26, 2018 12:58 PM
    Tuesday, September 25, 2018 2:09 PM
  • Today I saw "appx deployment service (appxsvc), svchost.exe -k wsappx -p" causing about a 10 minute login in windows 10 1703.  It's on a few "kiosk" computers that have a lot of logins.  I know when you delete a profile, a lot of things get left behind, and services like this use more and more resources.  I just wish this would get fixed. 

    That sounds like an ideal case for LTSB, if you have that option.

    Alternatively, some mechanism for regular wipe and reimage (e.g. via Wake-on-Lan plus PXE) would at least clear out the stuff getting left behind by profile deletion.

    Tuesday, September 25, 2018 2:39 PM
  • I would try something like this, but uninstalling 77 apps give an error (EDIT:  have to specify "-user sid" for the 2nd command).

    Get-AppxPackage -user user1 | Remove-AppxPackage

    Remove-AppxPackage : Deployment failed with HRESULT: 0x80073CFA, Removal failed. Please contact your software vendor.
    Deployment DeStage operation with target volume C: on Package
    Microsoft.Windows.Photos_2018.18081.14710.0_x64__8wekyb3d8bbwe from:   failed with error 0x80070490. See
    http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app deployment issues.
    NOTE: For additional information, look for [ActivityId] 1ae96f41-51ea-0001-840b-ec1aea51d401 in the Event Log or use
    the command line Get-AppxLog -ActivityID 1ae96f41-51ea-0001-840b-ec1aea51d401
    At line:1 char:32
    + Get-AppxPackage -user user1 | Remove-AppxPackage
    +                                ~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : WriteError: (Microsoft.Windo...__8wekyb3d8bbwe:String) [Remove-AppxPackage], IOException
        + FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.RemoveAppxPackageCommand


    Wow, here's a post that talks about editing the srd file with sqlite.  https://www.reddit.com/r/sysadmin/comments/4u3nm7/windows_10_do_not_delete_a_local_user_account/


    • Edited by JS2010 Sunday, September 30, 2018 12:15 AM
    Tuesday, September 25, 2018 4:18 PM
  • Hmm, I have over 30,000 entries in the PackageUser table in the sqlite database C:\ProgramData\Microsoft\Windows\AppRepository\StateRepository-Machine.srd, but deleting profiles with wmi seems to work on a 1 by 1 basis.  AppxSvc seems to clean up the sqlite database after the fact, at full cpu and i/o priority mind you.  I'm not sure why it's piling up.  I delete over 100 profiles each morning.

    • Edited by JS2010 Friday, September 28, 2018 11:48 AM
    Thursday, September 27, 2018 10:06 PM
  • So I figure if I'm deleting over 100 profiles for 20 minutes, the appxsvc is going to run at full priority for an hour to clean up the appxpackage info, bringing down the performance of the computer until it's done.  This is how I'm counting the rows in the packageuser table in StateRepository-Machine.srd, as they get deleted, after downloading the sqlite shell (run as admin):

    $a = 'select * from packageuser;' |
      .\sqlite3 -csv -header C:\ProgramData\Microsoft\Windows\AppRepository\StateRepository-Machine.srd |
      convertfrom-csv
    $a.count


    • Edited by JS2010 Tuesday, October 2, 2018 5:50 PM
    Saturday, September 29, 2018 8:14 PM
  • Last night I saw a computer delete about 200 profiles with wmi, and it took 7 and a half hours, starting at 3 am.  Appxsvc was still at 25% max cpu when I checked on it.    I don't know what to do at these locations except reimage and disable the microsoft store.

    Friday, October 5, 2018 3:07 PM
  • Friday, October 5, 2018 8:44 PM
  • Last night I tried pausing every profile deletion until appxsvc wasn't using any cpu.  It seemed to work well, although one computer kept going for 7 hours until the script saw it was past 7am and stopped (8:15am !).


    get-date
    $profiles = get-wmiobject win32_userprofile
    $excludedprofilelist = 'c:\Users\user1','c:\users\user2'
    $myprofiles = $profiles |
    where { !$_.Special -and $excludedprofilelist -notcontains $_.LocalPath }
    $sleepseconds = 1
    $numcores = 4
    foreach ($profile in $myprofiles) {
    $profile.delete()
    "deleting profile $($profile.localpath) $?"
    # wait for appxsvc to finish
    do {
    # make sure it's running
    $id = Get-WmiObject Win32_Service -Filter "Name = 'appxsvc'" |
    select -expand processid
    $cpu1 = (get-process -Id $id).cpu
    sleep $sleepseconds
    $cpu2 = (get-process -Id $id).cpu
    $cpu = [int](($cpu2 - $cpu1)/($numcores*$sleepseconds) * 100)
    } while ($cpu)
    # stop after 7 am
    if ( (get-date).hour -gt 7 ) { break }
    }
    get-date
    • Edited by JS2010 Friday, October 12, 2018 10:36 PM
    Thursday, October 11, 2018 2:51 PM
  • I think the problem is, appxsvc runs a new thread for every profile deleted.  So they're all running at normal priority.  If you delete a lot of profiles, that's a lot of normal priority threads.  I'll try to provide a procexp screenshot later.


    • Edited by JS2010 Monday, October 15, 2018 4:17 AM
    Monday, October 15, 2018 4:17 AM
  • I only deleted 25 profiles, but you can see how multiple threads use cpu (and i/o).  One thread may be limited to 25% cpu, but multiple threads that clean up 100 or 200 profiles can easily overwhelm a computer.  (Plus MpsSvc, the firewall service, has to process all the extra appx firewall rules that never get cleaned.)



    • Edited by JS2010 Monday, October 15, 2018 7:06 PM
    Monday, October 15, 2018 5:59 PM
  • So did you read the link on how to clean up profiles?

    You seem to use a different approach, is there a reason?

    Monday, October 15, 2018 6:44 PM
  • I'm currently in 1709.  This is an ongoing challenge to delete a lot of profiles in the morning.  This registry entry seems to fill without bounds sometimes and cause appxsvc to peg at 25% cpu.  I can easily tell with process monitor.

    # cleanup appxsvc
    # does it make it worse?
    $sids = Get-CimInstance win32_userprofile | select -expand sid
    $keys = ls 'HKLM:\SOFTWARE\classes\local settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Deployment\Package\*\*'
    $DeleteList = $keys | where { $_.PSChildName -ne 'AllUsers' -and
      -not ($_.PSChildName -in $sids) }
    $DeleteList rm -r-verbose # -whatif

    Wow, just one key in here has almost 15,000 values!

    PS C:\> $a = get-item 'HKLM:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Deployment\Package\*\S-1-5-21-3423303271-3025932689-3187700767-218860\{7C75622F-1

    271-4E2F-9FE9-F8220EFDBEAE}'


    PS
    C:\> $a.property.count

    14943

    2.4 million values total!

    PS C:\> $a = ls -r 'hklm:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Deployment\Package\*\*'


    PS
    C:\> $a.property.count
    2466791

    This daily scheduled task may cause that area of the registry to be read:
     
    \Microsoft\Windows\ApplicationData\appuriverifierdaily

    • Edited by JS2010 Tuesday, February 5, 2019 9:19 PM
    Tuesday, February 5, 2019 5:28 PM
  • Hello,

    Can you try this with Windows 10 1809 to see if this was addressed, I thought we took a fix in that release to help with this issue?

    You may need to open a support case to get help on Windows 10 1709.


    Thanks, Darrell Gorter [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, February 5, 2019 10:57 PM