Powershell script runs but......
-
Looking at your script what is
'path.to.file'
value set to?For our MDT deployment script the command is
setup.exe /adminfile "Office_MSP_012118.MSP"
for our 2016 install.I could also see
'/adminfile .\FogOffice2013.MSP'
also might be a problem. In that.\
might not be expanded correctly. You might want to use%~dp0\
there. -
@george1421 the path.to.file is set to the network location location of the the setup.exe that runs the .msp. I am running ours via powershell which is why .\ is there, it wouldn’t run without it. Like I said above the script runs just fine. Its just that fog comes back saying its completed almost immediately. Which it will complete just 4 or 5 mins later. I will however try your suggestion.
-
@BREIT Just so I understand it correctly. The script does execute and give the expected results in the end. The issue is that the FOG client is launching the process and then closing out saying that its done, and not launching and waiting until the install is finished.
When you run the same PS script interactively the script will remain running until the application is installed?
-
@george1421 Yes you are following correctly. If I run the script manually it will run until that file shows up then exit as expected.
-
@BREIT I know with batch scrips under certain conditions you need to start subprocesses with the
start /wait <command_to_run>
I just did a quick check and PS has a comparable switch.So I wonder what would happen if you changed your start process to this:
Start-Process 'Path.To.File' -ArgumentList '/adminfile .\FogOffice2013.MSP' -Wait
I agree the fog client should wait until the subprocess is done, the launch for the office install may be doing something strange that the fog client isn’t expecting. I think the devs should look at the code for the fog client, but the above flag may get you pass the issue until it can be researched a bit more.
-
@george1421 -Wait was one of the first things I tried. Same thing happened. I might try to make a batch script and try /wait for kicks and giggles. Curious to see if it would still happen or if it would work as expected. I might give that a go tomorrow.
-
@BREIT Okay, so I am back at work today… and it looks like the fastest solution to your issue would be to get the -wait to work properly. I had a similar issue in a powershell script I made for deploying Lanschool.
The answer for getting the Powershell script to stay open until the program installs (and thus, the FOG notification will be accurate) was the | Out-Null
I got this answer from here:
https://stackoverflow.com/questions/1741490/how-to-tell-powershell-to-wait-for-each-command-to-end-before-starting-the-nextBelow is a piece of my powershell script as an example:
msiexec /i $teacher /qn ADVANCED_OPTIONS=1 CHANNEL=$channel ALLOW_DUMP_UPLOADS=0 | Out-Null
I had promised you my Snapin Pack setup of Office 2013 as well, so I will post that as a 2nd comment to keep things cleaner.
-
@jflippen Thanks. I’ll look into this.
-
@BREIT As promised, here is my setup for Office 2013.
Snapin Pack settings:
Inside of the zipped Office 2013 folder:
And inside of updates folder:
Using this I have FOG download, install, and activate office for me even if I’m not on the domain yet.
Let me know if you have questions.
-
Thanks for everyones help. I decided to try it on an actual device and add the -Wait at the end and that worked. @jflippen your way worked as well. For what ever reason my VM was would both say complete right after the start of script. When I attempted to run it on a physical PC it worked without any issues and completed with the delays.