Deploying modern apps to a 64 bit Windows 8 machine using SCCM 2007

Firstly, this is simply a post aimed at helping people deploy modern apps to Windows 8 machines. It doesn’t touch on actually creating the apps and getting them signed – that’s another matter and one which I don’t get involved in!

Secondly, before you do anything in SCCM, you need to ensure that you have turned on sideloading on the Windows 8 machine. Enabling this setting allows the installation of trusted app packages that do not originate from the Windows Store. To do so follow the below instructions:

SideLoadingPolicy

So I was asked to help test deploying a custom modern app (via a Powershell script), to a 64 bit Windows 8 desktop, using SCCM 2007. All in all it was a fairly simple task but there were one or two issues we had to overcome, which might be of help to someone else out there.

I started the test by getting the source files (which included both a signed ps1 and appx file), creating a package and program in SCCM 2007 before deploying them to a test collection using an optional advert, much like any normal application. I did ensure that the program setting to “Allow users to interact with this program” was checked as I wanted to see any possible errors that would appear on screen.

When I first manually ran the advert I got the following error:

TestModernApp.ps1 cannot be loaded because running scripts is disabled on this system

This was a strange error as I was using a signed ps1 file and had already set the execution policy of Powershell on my test Windows 8 machine to AllSigned – http://technet.microsoft.com/en-us/library/ee176961.aspx – to ensure I don’t get any Powershell errors. After a bit of digging it turns out that on 64 bit machines there are two instances of Powershell, a 32 bit and a 64 bit version, both with separate execution policies. When I searched for Powershell in the Start screen and opened it as admin, it opened the 64 bit version only and so I had to run the same command on the 32 bit version as well. To do this I went to %windir%\SysWOW64\WindowsPowerShell\v1.0, opened up Powershell.exe as admin and ran the same set-ExecutionPolicy AllSigned command. I then ran the advert manually again and it no longer errored at this point.

If you are getting problems at this point, I suggest you set the execution policy of both instances of Powershell to Unrestricted but be aware of the possible security implications of allowing any ps1 script from running.

Unfortunately though, after fixing this issue another error then occurred:

add-appxpackage : Deployment failed with HRESULT: 0x80073CF9, Install failed.

Deployment Add operation rejected on package TestModernApp.appx install request because the Local System account is not allowed to perform this operation.

It is stating that, as I have set the SCCM program to “Run with administrative rights”, its using the SYSTEM account  to install the application, which is obviously causing a problem. With modern apps though, what needs to be remembered is that when they install, they do so on a per-User basis, unlike normal apps that install to the device. As this is the case it means that users don’t need to be local administrators to install modern apps. Therefore you need to set the program to “Run with user’s rights”:

Capture

After changing the program to the above, the modern app installed with no issues.

appxInstall