• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Powershell script runs but......

Scheduled Pinned Locked Moved Solved
FOG Problems
4
14
769
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G
    george1421 Moderator
    last edited by Dec 3, 2018, 4:47 PM

    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.

    Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

    B 1 Reply Last reply Dec 3, 2018, 5:00 PM Reply Quote 0
    • B
      BREIT @george1421
      last edited by Dec 3, 2018, 5:00 PM

      @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.

      G 1 Reply Last reply Dec 3, 2018, 5:17 PM Reply Quote 0
      • G
        george1421 Moderator @BREIT
        last edited by Dec 3, 2018, 5:17 PM

        @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?

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

        B 1 Reply Last reply Dec 3, 2018, 7:11 PM Reply Quote 0
        • B
          BREIT @george1421
          last edited by Dec 3, 2018, 7:11 PM

          @george1421 Yes you are following correctly. If I run the script manually it will run until that file shows up then exit as expected.

          G 1 Reply Last reply Dec 3, 2018, 7:27 PM Reply Quote 0
          • G
            george1421 Moderator @BREIT
            last edited by Dec 3, 2018, 7:27 PM

            @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

            ref: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/start-process?view=powershell-6

            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.

            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

            B 1 Reply Last reply Dec 3, 2018, 7:32 PM Reply Quote 0
            • B
              BREIT @george1421
              last edited by Dec 3, 2018, 7:32 PM

              @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.

              J 1 Reply Last reply Dec 4, 2018, 4:25 PM Reply Quote 0
              • J
                jflippen @BREIT
                last edited by Dec 4, 2018, 4:25 PM

                @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-next

                Below 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.

                B 1 Reply Last reply Dec 4, 2018, 4:33 PM Reply Quote 0
                • B
                  BREIT @jflippen
                  last edited by Dec 4, 2018, 4:33 PM

                  @jflippen Thanks. I’ll look into this.

                  1 Reply Last reply Reply Quote 0
                  • J
                    jflippen @BREIT
                    last edited by Dec 4, 2018, 4:44 PM

                    @BREIT As promised, here is my setup for Office 2013.
                    Snapin Pack settings:
                    0_1543940813712_c5e9153a-c4d0-4f32-b235-b5879a0106b2-image.png

                    Inside of the zipped Office 2013 folder:
                    0_1543940980356_f805ae9a-5ad7-4720-a54c-6a6ef920a588-image.png

                    And inside of updates folder:
                    0_1543941043571_d1bcf0e9-3152-496b-95e9-dec7f9b7495f-image.png

                    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.

                    1 Reply Last reply Reply Quote 0
                    • B
                      BREIT
                      last edited by BREIT Dec 11, 2018, 10:00 AM Dec 11, 2018, 4:00 PM

                      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.

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      1 / 1
                      • First post
                        14/14
                        Last post

                      155

                      Online

                      12.0k

                      Users

                      17.3k

                      Topics

                      155.2k

                      Posts
                      Copyright © 2012-2024 FOG Project