6 Replies Latest reply on Feb 15, 2019 7:48 AM by phoffmann

    Powershell distribution packages fails

    jlelong Apprentice

      Hi there ,

       

      I'm trying to run a shell script from the Powershell distribution packages, the problem is that the powershell tasks always remain active with no return.

      my need is to uninstall sophos and these components on the client machines .

       

      I used the command " set-executionpolicy unrestricted " to start the powershell script  , but it always failed

      ps.JPG

       

      Any help please !!!

       

      Thank you

        • 1. Re: Powershell distribution packages fails
          phoffmann SupportEmployee

          Urm - so the command-line parameter line is for additional command line SWITCHES ... so things like (say) "/NoGUI" for an installer or "-Param MyParameter" for a script.

           

          It's not a "run this command before you run my file / script".

           

          Check the client-side log(s) (and/or add logging to your own powershell script to see where you're running into issues for example).

           

          As a leg up - here's a little logging function I've created / used for a few years now in powershell ...

           

          ######################################################

           

          ### LOGGER FUNCTION ###

          # Simple logger function to keep track of things & write desired strings into out log.

          # Will create an empty line (for white space) if the string handed to it is empty.

          ######################################################

          function Logger ([string]$LogString) {

             if ($LogString -eq "") {

             Out-File -FilePath $LogFilePath -inputobject "" -Append

             Write-Host ("")

            }

             else {

            [string]$FullLineString = (Get-Date -Format r).ToString() + " :: " + $LogString

             Out-File -FilePath $LogFilePath -inputobject $FullLineString -Append

             Write-Host $FullLineString

            }

          } # Close LOGGER function.

           

          Note that you need to have the "$LogFilePath" defined as a (global) variable, so you know / specify where the entries get written to .

           

          Hope that helps.

          • 2. Re: Powershell distribution packages fails
            jlelong Apprentice

            phoffmann ,

            I added the logging function provided in my script but I don't see any logs on the file

            Capture.JPG

            • 3. Re: Powershell distribution packages fails
              phoffmann SupportEmployee

              OK - so do *NOT* write to a network share for one. You're supposed to write to a LOCAL location like "C:\Temp\Mylog.txt".

               

              Remember that the script is running as "LOCAL SYSTEM" by default -- and (even as a domain device) LOCAL SYSTEM is NOT going to authenticate to a UNC-share unless you rip it somewhat open.

               

              It's intended to be written to LOCALLY ... and you then hoover the log up from the local device. The "Keep things as simple as possible" principle applies - you don't want to deal with network authentication within the script (and have that cause you grief).

               

              So - follow the principle of keeping things as simple as possible, no need to add additional points of failure for yourself .

              • 4. Re: Powershell distribution packages fails
                jlelong Apprentice

                phoffmann , sorry i'm new here , I did as you asked, but it still doesn't work. 

                I added the logging function provided in my script but I don't see any logs on the file

                otherwise , I just saw by a manual installation that the script asks to close google chrome to continue the installation

                Capture.JPG

                 

                Thanks a lot

                • 5. Re: Powershell distribution packages fails
                  karlehenry Apprentice

                  So, i do not know if this information will help you but I have had lots of trouble with Powershell and running MSI's recently.  I cant explain it but for whatever reason, Ivanti EPM and Windows plays differently together with scripts and commands when run locally on the system.

                   

                  What We have noticed is, things work better with a full path.  The reason is, at least for us, windows is changing the path from system32 to syswow64 and if there is no 32bit program in syswow64, the program fails.  So just wanted you to keep this in mind.

                   

                  As far as the script always running, I have learned, that their is some kind of hidden confirmation window where a user action is requires.  Turn off all silent switches, and run the script as an admin to see if you can figure it out.  I spent a lot of time trying to deploy Infrastructure Design Suite by Autodesk and this is what i Saw. 

                   

                  We just went through a SOPHOS upgrade our selves and their automation script WILL NOT Run when landesk deploys it. simply because of bdehdcfg.exe only being 64bit.  I had to create a seperate power shell script to install it by copying all the bdehdcfg.* files to syswow64.

                   

                  You can also try playing with the architecture and specify 64 bit or 32 bit in the package.  I apologize if i do not have an answer, just wanted to share my experiences as i know every bit of information helps.

                  1 of 1 people found this helpful
                  • 6. Re: Powershell distribution packages fails
                    phoffmann SupportEmployee

                    Ooo - nice tips.  Thanks for sharing!

                     

                    *scribbles down a few personal notes*