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

    execute batch file snapin

    FOG Problems
    2
    11
    159
    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.
    • B
      bylkem last edited by

      Hello, I would like to run a batch script that allows me to make a battery report on my laptop.
      The fog agent is well installed on the target machine, the machine receives the task and installs it but does not execute it.
      Thanks in advance for any help
      (I am a beginner)

      ps : the script is C:\Windows\System32\powercfg.exe /batteryreport

      1 Reply Last reply Reply Quote 0
      • S
        Sebastian Roth Moderator last edited by

        @bylkem You can run whatever you want via snapin BUT it needs to run unattended (no user interaction) without GUI and access rights as SYSTEM user.

        So for MSI/EXE installer you will need to find out if it can be run in so called silent installer mode. Ever program is different and ther is no general information we can provide about this.

        This all is beyond what we as the FOG team can do for you.

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        1 Reply Last reply Reply Quote 0
        • B
          bylkem @Sebastian Roth last edited by

          @sebastian-roth Your script worked perfectly, so if i understand i cant start a bat file after deployment with just a script.
          If i want install program i need to use msi or exe and if i want to create folder or change anything in the client machine (register) i need to use bat or bash?
          my problem is maybe in snapin argument (i leave as default) or in my script?

          1 Reply Last reply Reply Quote 0
          • S
            Sebastian Roth Moderator last edited by

            @bylkem The fog-client runs as a service. You can’t expect for programs to run just the same way as they would when run manually on the client. For example I don’t think you can run GUI programs at all. Any kind of user interaction is impossible. I suggest you start by creating a very simple batch file.

            @echo off
            echo test >> C:\Windows\Temp\fog-client-test.log
            

            Make sure the SYSTEM account has write access to the directory and see if it works.

            Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

            Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

            B 1 Reply Last reply Reply Quote 0
            • B
              bylkem @Sebastian Roth last edited by

              @sebastian-roth thanks for the reply, my SYSTEM account have all right (admin), i tried another thing, i converted bat file to exe and created snapin for.

              When i start the task, the .exe appear successfully on client desktop but doesnt launch, is there a way to automate the start of the .exe after its installation in 1 snapin?

              1 Reply Last reply Reply Quote 0
              • S
                Sebastian Roth Moderator last edited by

                @bylkem said in execute batch file snapin:

                for the firefox script it is supposed to open a firefox page with the associated url but no page is opened

                You might want to read up on Windows services and the SYSTEM account. I don’t think there is an easy way of doing that.

                For the SYSTEM account right, can I have more details?

                Did you read the forum post I linked before? https://forums.fogproject.org/post/126904

                Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                B 1 Reply Last reply Reply Quote 0
                • B
                  bylkem @bylkem last edited by

                  Here’s the notification fogtray.png

                  1 Reply Last reply Reply Quote 0
                  • B
                    bylkem @Sebastian Roth last edited by

                    @sebastian-roth said in execute batch file snapin:

                    C:\Windows\System32\powercfg.exe /batteryreport

                    my first goal is to make a snapin test to open firefox on my remote windows 10 with a batch script, I tried several ways (snapinpack, change the storage group…) but no batch script launches.
                    However I get a notification in the bottom right corner of windows 10 saying that “[file.bat]” is installed, so my remote machine receives the snapin but it does not launch.

                    Is there a problem in the script?
                    Or a problem between the server and the client?

                    I can’t find the problem

                    For the script C:\Windows\System32\powercfg.exe /batteryreport, it is supposed to create a report file in the program files but I can’t find the file in question, for the firefox script it is supposed to open a firefox page with the associated url but no page is opened

                    For the SYSTEM account right, can I have more details?

                    Thanks in advance

                    B 1 Reply Last reply Reply Quote 0
                    • S
                      Sebastian Roth Moderator last edited by Sebastian Roth

                      @bylkem From the log things look fine I think.

                      the machine receives the task and installs it but does not execute it.

                      How do you know it’s not executed?

                      You need to know that the fog-client runs as a Windows service as user SYSTEM. So many things behave different to what you might expect if you run the batch manually on a PC just because access rights and environment variables are different.

                      the script is C:\Windows\System32\powercfg.exe /batteryreport

                      Do you log the output to some file? Make sure the SYSTEM account has rights to write to that directory/file. As well I am not exactly sure SYSTEM can run this tool. You can try using PsExec (https://forums.fogproject.org/post/126904)

                      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                      B 1 Reply Last reply Reply Quote 0
                      • B
                        bylkem @Sebastian Roth last edited by

                        @sebastian-roth here’s the fog.log fog.log
                        When i say the machine receives the task and install, the client machine (windows 10) install successfully the snapin, i got notification from win10 too but nothing happened.

                        Today i think i got a new problem because fog log says middleware is disabled.

                        1 Reply Last reply Reply Quote 0
                        • S
                          Sebastian Roth Moderator last edited by

                          @bylkem said:

                          … the machine receives the task and installs it but does not execute it.

                          How do you see the task is “installed”??

                          Please upload the contents of the log file (C:\fog.log) and post a link here.

                          Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                          Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

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

                          100
                          Online

                          10.4k
                          Users

                          16.4k
                          Topics

                          150.5k
                          Posts

                          Copyright © 2012-2023 FOG Project