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

How to automatically run several .bat scripts after image deployment

Scheduled Pinned Locked Moved Solved
Windows Problems
5
6
1.9k
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.
  • M
    mecsr
    last edited by mecsr Jul 23, 2018, 10:58 AM Jul 23, 2018, 4:55 PM

    Much of the software that is installed on our images requires licensing after deployment in order for it to work. I have made a couple of .bat scripts that will do that silently. Is there a way to have them automatically run after deployment of the image or upon logging for the first time?

    I am looking for whatever solution people have found for this, whether there is some FOG feature that will do this or some workaround in Windows itself.

    Thanks in advance!

    1 Reply Last reply Reply Quote 0
    • G
      george1421 Moderator
      last edited by george1421 Jul 23, 2018, 11:37 AM Jul 23, 2018, 5:36 PM

      There are a number of ways you can go about this. One method is with fog and the other method is with windows.

      1. FOG Method: Create a batch file snap-in a attach the snap-in to a FOG group.
      2. Windows Method(s):
        a) add the batch commands to the setupcomplete.cmd file before you capture the image. The setupcomplete.cmd batch file is run at the end of OOBE and just before the login is displayed.
        b) Add the batch commands to the unattend.xml in the first run section. Then configure auto admin login for a login count of 1. Setup the last first run sequences to shutdown / reboot / after 15 seconds / while displaying “this computer will reboot in 15 seconds”

      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!

      1 Reply Last reply Reply Quote 1
      • M
        mecsr
        last edited by Jul 23, 2018, 5:41 PM

        Thanks for the reply! I’m going to get working on these.

        J 1 Reply Last reply Jul 23, 2018, 6:11 PM Reply Quote 1
        • J
          JJ Fullmer Testers @mecsr
          last edited by Jul 23, 2018, 6:11 PM

          @mecsr Use powershell instead of bat scripts, you’ll have more power. Pun intended, but it’s also just true. Especially when it comes to licensing tools. Sometimes the tools just don’t have command line options. Powershell has more user friendly tools for editing registry keys and environemnet variables which licenses sometimes require.

          Also use the windows system image manager included in the windows ADK for creating an unattend.xml file

          Snapins are an excellent method.

          Have you tried the FogApi powershell module? It's pretty cool IMHO
          https://github.com/darksidemilk/FogApi
          https://fogapi.readthedocs.io/en/latest/
          https://www.powershellgallery.com/packages/FogApi
          https://forums.fogproject.org/topic/12026/powershell-api-module

          1 Reply Last reply Reply Quote 1
          • W
            Wayne Workman
            last edited by Wayne Workman Jul 23, 2018, 4:11 PM Jul 23, 2018, 10:09 PM

            I learned scripting when I was 13, I used DOS from floppy disks because my computer’s hard drive failed and didn’t work… and I self-taught myself using a DOS for Dummies book from the public library. That was about 18 years ago and it was obsolete then… Now I cringe when I think about bat files. Python, please and thank you.

            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!
            Daily Clean Installation Results:
            https://fogtesting.fogproject.us/
            FOG Reporting:
            https://fog-external-reporting-results.fogproject.us/

            1 Reply Last reply Reply Quote 0
            • T
              Tom Elliott
              last edited by Jul 23, 2018, 11:00 PM

              I suppose, to answer the question more directly, you can do a snapin pack.

              Create a base batch file, and all your others. Create them into a zip file. Your “base” batch file would simply call the other batch files as required.

              For example, you create a snapin pack with licensing.zip as the base name.

              Inside licensing.bat you would, essentially, have:

              @echo off
              %~dp0\license1.bat
              %~dp0\license2.bat
              %~dp0\license3.bat
              %~dp0\license4.bat
              %~dp0\license5.bat
              %~dp0\license6.bat
              %~dp0\license7.bat
              %~dp0\license8.bat
              %~dp0\license9.bat
              %~dp0\license10.bat
              %~dp0\license11.bat
              %~dp0\license12.bat
              %~dp0\license13.bat
              

              (Some of the syntax may be off, but the idea is the same. For what it’s worth, the %~dp0 is windows slang for, the current drive and path of the running script, this way you don’t have to hardcode the path to find these other files.)

              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! Get in contact with me (chat bubble in the top right corner) if you want to join in.

              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
              • 1 / 1
              1 / 1
              • First post
                3/6
                Last post

              165

              Online

              12.0k

              Users

              17.3k

              Topics

              155.2k

              Posts
              Copyright © 2012-2024 FOG Project