1

I am looking for guidance concerning performing the above task.

My Powershell script is as below, the script currently removes one specific named app.

$AppsToDelete="*Microsoft.WindowsReadingList*"
 Foreach ($AppName in $AppsToDelete)
 {
     get-appxprovisionedpackage -online | where packagename -like $AppName | remove-appxprovisionedpackage -Online
     Get-AppxPackage -name $AppName -allusers | Remove-AppxPackage
 }

The program used by SCCM2012 to execute the script is as follows -

PowerShell.exe -ExecutionPolicy UnRestricted -File .\delappsreadinglistonly.ps1

I have created a program in SCCM 2012 and deployed to a client.

The program is set to run as the user, not system,

The EXECMGR.log file tells me the script is received by the client and has run successfully, exit code = 0, the execution status is Success.

That said, the Reading List tile is still on the ( Metro ?) start screen, the Reading List app still appears in the Apps by name alphabetical list and can be executed and various folders still exist in C:\program files\windowsapps\

Pointers would be appreciated.

2
  • 1
    I know it may be a silly comment, but I will point out that if the machine is still in the SCCM collection to get that app, the app will just be reinstalled after it is removed.
    – EBGreen
    Commented Dec 10, 2015 at 16:28
  • Hello, thanks for your comment. For the avoidance of doubt, the ' apps ' that I want to remove are the various ' apps ' incorporated into the windows 8.1 OS and visible as tiles on the Metro start screen. I believe such ' apps ' are known as .appx. They are not applications as delivered using the method within SSCM 2012. Apologies for the confusion. Thanks.
    – mcbla
    Commented Dec 11, 2015 at 16:55

1 Answer 1

1

I see two potential problems with your script:

  1. The calls to -AppxProvisionedPackage most likely require elevation. When you run your script as a user it probably throws an exception.
  2. The call to Get-AppxPackage -allusers requires administrator permissions. The documentation for -allusers reads "to use this parameter, you must run the command by using administrator permissions."

It's not clear to me exactly what your goal is. Here is how I deal with the mess of tiles in the Windows 8.1 start screen:

  • Create an SCCM Application with the following characteristics:
    • no installer
    • uninstaller that calls Remove-AppxPackage for a list of common apps
    • detection script for that list of apps
  • Deploy the Application with the Uninstall Action to the affected users.

I use this strategy because it sets things up to be more surgical with which of those apps is available to specific users in the future if that turns out to be necessary.

When a user to which this Application is deployed for removal is logged in, CcmExec eventually detects the application and invokes the uninstall command. After the uninstall command is invoked the applications should no longer be visible or available to the user.

Uninstall-Application.ps1

Here is the body of the uninstall script I use. You need to be careful about how you set up PowerShell scripts that are invoked for (un)installation because exit codes are a bit tricky to get from the script reliably.

$appList =  'Microsoft.BingSports',
            # ...longlist of other apps...
            'Microsoft.WindowsReadingList'
Get-AppxPackage | 
    ? { $_.Name -in $appList } | 
    % { Remove-AppxPackage $_.PackageFullName }

Detect-Application.ps1

Below is the body of the detection script I use. Note that there are some pitfalls to using PowerShell detection scripts:

If you do all that PowerShell detection scripts work beautifully for complicated, surgical, or unconventional detection like this.

    $appList =  'Microsoft.BingSports',
            # ...longlist of other apps...
            'Microsoft.WindowsReadingList'
    Get-AppxPackage | 
    ? { $_.Name -in $appList }
1
  • alx9r, thanks for the pointers, very comprehensive. I will give this a try in due course. I have been away hence the late response. Thank you again.
    – mcbla
    Commented Dec 18, 2015 at 9:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .