Jump to content

Recommended Posts

Posted

Hi Everyone,

 

So when I built the 1803 image for our school I screwed up and removed the photos app. This has caused a lot of trouble, no surprise, so I am trying to roll it out via GPO. I have managed to obtain the appxbundle file and associated license and want to install these from a startup script on the workstations. I have this as my command which works when its run manually but doesn't seem to do anything as a startup script.

 

Add-AppxProvisionedPackage -Online -PackagePath ".appxbundle" –LicensePath "Microsoft.Windows.Photos_8wekyb3d8bbwe.xml"

 

It says Applying Software Installation Policy when the computer is restarted but nothing happens.

 

Any ideas?

Posted

I resolved this, it turns out that you have to use DISM commands if you are running at startup via GPO otherwise it doesn't work. On a separate note I don't want this to run everytime as it slows down computer startup so I want to do an if folder exists statement which I can do with a batch file as follows:

@echo off

if exist "C:\Program Files\WindowsApps\Microsoft.Windows.Photos_2018.18011.15918.0_x64__8wekyb3d8bbwe" goto end

Powershell.exe set-executionpolicy bypass "\\(networkshare)\Windows Photos\InstallPhotosDISM.ps1"

:end

 

This alone won't call the powershell applet but does anyone know how to make this whole command into a powershell script?

Posted (edited)
I resolved this, it turns out that you have to use DISM commands if you are running at startup via GPO otherwise it doesn't work. On a separate note I don't want this to run everytime as it slows down computer startup so I want to do an if folder exists statement which I can do with a batch file as follows:

@echo off

if exist "C:\Program Files\WindowsApps\Microsoft.Windows.Photos_2018.18011.15918.0_x64__8wekyb3d8bbwe" goto end

Powershell.exe set-executionpolicy bypass "\\(networkshare)\Windows Photos\InstallPhotosDISM.ps1"

:end

 

This alone won't call the powershell applet but does anyone know how to make this whole command into a powershell script?

 

Something along the lines of;

if (-Not (test-path "C:\Program Files\WindowsApps\Microsoft.Windows.Photos_2018.18011.15918.0_x64__8wekyb3d8bbwe")) { 
   Add-AppxProvisionedPackage -Online -PackagePath ".appxbundle" –LicensePath "Microsoft.Windows.Photos_8wekyb3d8b bwe.xml" 
}

Edited by itwasntme
  • Thanks 1
Posted

This should do the trick:

 

if(!(Test-Path "C:\Program Files\WindowsApps\Microsoft.Windows.Photos_2018.18  011.15918.0_x64__8wekyb3d8bbwe")){
&"\\(networkshare)\Windows Photos\InstallPhotosDISM.ps1"
}

 

(Test-Path "C:\Program Files\WindowsApps\Microsoft.Windows.Photos_2018.18 011.15918.0_x64__8wekyb3d8bbwe") returns true if the path exists, and false if it doesn't. The ! in front of it flips this so that it returns true if the path doesn't exist.

 

Then simply call your other script and run it using the &.

  • Thanks 1
Posted
Thanks guys these both work well, I'm assuming that it doesn't need anything else to make it quit as if the folder is present it just stops right?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...