Author Posts

October 10, 2013 at 12:27 am

I'm trying to use a PS script (I'm new to scripting) to remove the Provisioned apps on the Windows 8 start screen

I got this script from the Microsoft forum

$AppsList = "Microsoft.Bing" , "Microsoft.BingFinance" , "Microsoft.BingMaps" , "Microsoft.BingNews",`
"Microsoft.BingSports" , "Microsoft.BingTravel" , "Microsoft.BingWeather" , "Microsoft.Camera",`
"microsoft.microsoftskydrive" , "Microsoft.Reader" , "microsoft.windowscommunicationsapps",`
"microsoft.windowsphotos" , "Microsoft.XboxLIVEGames" , "Microsoft.ZuneMusic", "Microsoft.ZuneVideo"

#ForEach ($App in $AppsList)
# {
# $PackageFullName = (Get-AppxPackage $App).PackageFullName
# if ((Get-AppxPackage $App).PackageFullName)
# {
# Write-Host "Removing Package: $App"
# remove-AppxProvisionedPackage -online -packagename $PackageFullName
# remove-AppxPackage -package $PackageFullName
# }
# else
# {
# Write-Host "Unable to find package: $App"
# }
# }
This works fine if you are logged on to an account but I am calling the script from an SCCM deployment. Whilst running it no profiles have been set up so you can't seem to issue the get-appxpackage command

I'm trying to remove the Provisionedpackages in the image so I tried to use the same syntax to get the Packagename of the provisioned app e.g. $PackageFullName = (Get-AppxProvisionedPackage -online $App).PackageName and variants of this but could not get it to work.
If I manually put each one in longhand it works fine e.g.

remove-AppxProvisionedPackage -package Microsoft.Bing_1.2.0.137_x86__8wekyb3d8bbwe -online
remove-AppxProvisionedPackage -package Microsoft.BingFinance_1.2.0.135_x86__8wekyb3d8bbwe -online
remove-AppxProvisionedPackage -package Microsoft.BingMaps_1.2.0.136_x86__8wekyb3d8bbwe -online

But I'd prefer to read the packagenames properly in a script – can I do this ?

Thanks

PS – can anyone recommend book or video to learn PS scripting ?

October 11, 2013 at 3:13 am

If the full name works I'd stick with that

A good book to start your PowerShell learning?
http://www.manning.com/jones3/

also available from amazon etc

October 12, 2013 at 2:24 am

Many thanks for the book -have just ordered it. Yes can just put the name of each and every appxprovisionedpackage but I was hoping to use the short or displayname in the example and to be able to get the fullname out – if this can be done I'd be happy to hear

thanks