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

Post Download Scripts and Powershell

Scheduled Pinned Locked Moved
General
6
9
1.6k
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.
  • A
    ayashkam
    last edited by Aug 21, 2019, 12:30 AM

    Hello everyone,
    I am new to FOG and imaging in general, so any help would be appreciated!

    I am getting familiar with post download scripts through this article: https://forums.fogproject.org/topic/7740/the-magical-mystical-fog-post-download-script
    and I was wondering if it would be possible to execute a Powershell script on a target machine using post download scripts?
    Or would it be possible to trigger a Snap-in (that is pretty much that same powershell script) using post download scripts?

    Thanks!

    1 Reply Last reply Reply Quote 0
    • G
      george1421 Moderator
      last edited by george1421 Aug 20, 2019, 7:51 PM Aug 21, 2019, 1:51 AM

      @ayashkam said in Post Download Scripts and Powershell:

      I was wondering if it would be possible to execute a Powershell script on a target machine using post download scripts

      The short answer is no. The FOS Linux engine (the OS that captures and deploys images) is linux based and powershell is Windows based. There is no way for FOS Linux to directly call powershell and interact with the windows target system. Postdownload and PostInit scripts have to be bash or csh based.

      Once the target OS has started and the FOG Client is installed on the target computer you can run snapins on the target computer. Those snapins can call executable or scripts that execute on the target computer.

      What are you trying to accomplish? As you see from that tutorial you can leave “breadcrumbs” behind, where windows WinSetup/OOBE can pickup and use. FOG’s main goal is to push the image to the target computer the fastest way possible, then exit. This leaves the target computer’s setup to complete the configuration process.

      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!

      Q A 2 Replies Last reply Aug 21, 2019, 1:44 PM Reply Quote 0
      • D
        DBCountMan
        last edited by Aug 21, 2019, 1:19 PM

        how is FOG able to set the hostname in Windows immediately after imaging though? I’ve noticed that after imaging, the computer name in Windows is set to whatever i set the hostname to during the Full Registration process.

        G 1 Reply Last reply Aug 21, 2019, 1:59 PM Reply Quote 0
        • Q
          Quazz Moderator @george1421
          last edited by Aug 21, 2019, 1:44 PM

          @george1421 I believe Microsoft has been trying to create a cross platform powershell (https://devblogs.microsoft.com/dotnet/powershell-is-now-open-source-and-cross-platform/), though I don’t see us integrating that into FOS.

          E 1 Reply Last reply Aug 23, 2019, 10:18 PM Reply Quote 0
          • G
            george1421 Moderator @DBCountMan
            last edited by george1421 Aug 21, 2019, 8:00 AM Aug 21, 2019, 1:59 PM

            @brakcounty said in Post Download Scripts and Powershell:

            how is FOG able to set the hostname in Windows immediately after imaging though?

            If you use the standard name hosting within FOG, that is the FOG Clients job to rename the system. In this way the system when it first comes up will have the default system name and then will be renamed by the FOG Client. There is an early name change options, but I’m not sure that still works with Win10.

            As you seen in my scripts, I update the unattend.xml file from FOG during a post install script process. Here is a bit more refined tutorial that I mentioned before, it has less details but is more straight forward with the scripts: https://forums.fogproject.org/topic/11126/using-fog-postinstall-scripts-for-windows-driver-injection-2017-ed

            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 0
            • S
              Sebastian Roth Moderator
              last edited by Aug 21, 2019, 3:47 PM

              @george1421 said in Post Download Scripts and Powershell:

              how is FOG able to set the hostname in Windows immediately after imaging though?

              Actually there is a mechanism in FOS that uses Linux tools to modify Windows registry files to set the hostname. It’s kind of a hack but obviously works quite well.

              Still I don’t see why we should add powershell scripting capability. What exactly are you trying to do??

              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
              • A
                ayashkam @george1421
                last edited by Aug 21, 2019, 10:42 PM

                @george1421 Thanks for quick response!
                What I need is for some of the powershell scripts to execute on the host machines after the deployment. They are quite complex and Windows specific, so it is not desired to convert them into bash scripts.
                I was actually reading through this forum and somewhere it was written that Snapins associated with the host get executed after deployment (I initially thought they were just sent, but not executed). Could you please confirm that this is correct? I tested on one machine and it looks correct, but I would feel safer if you could confirm.
                If so, my problem would be solved by using snapins!

                G 1 Reply Last reply Aug 21, 2019, 11:03 PM Reply Quote 0
                • G
                  george1421 Moderator @ayashkam
                  last edited by george1421 Aug 21, 2019, 5:04 PM Aug 21, 2019, 11:03 PM

                  @ayashkam said in Post Download Scripts and Powershell:

                  I was actually reading through this forum and somewhere it was written that Snapins associated with the host get executed after deployment

                  That is correct, you can assign a snapin to a client or client group and when the system is images, that snapin task will be added to the task queue for that host. That task will be deployed once imaging is done. The only requirement is to have the FOG Client installed on the target computer. I believe there is even a template for powershell (sorry I can’t be absolute since I don’t use snapins in my environment).

                  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 0
                  • E
                    EduardoTSeoane @Quazz
                    last edited by Aug 23, 2019, 10:18 PM

                    @george1421 I confirm that exist powershell template :D:D:D .

                    @ayashkam You can do it, The automated snapin execution is basic for me, my images are living entities and my software requirements continously changes (Education environment with more than 250 different sites and more than 15.500 computers).

                    I have my image’s configured to install fogclient and start it on the first boot, you can do it with the unattended deployment procedures (setupcomplete.cmd) for example if you sysprep the images or use other ways like scheduling it at start up.

                    I download the installer with the postdownloadscript to ensure that the current version is installed. Take care because at the moment that you run the service the snapins start to be executed, you can have problems with another installations or the configuration can be disrupted by needed reboots. You know your systems and must take the cautions needed.

                    1 Reply Last reply Reply Quote 1
                    • 1 / 1
                    1 / 1
                    • First post
                      6/9
                      Last post

                    170

                    Online

                    12.0k

                    Users

                    17.3k

                    Topics

                    155.2k

                    Posts
                    Copyright © 2012-2024 FOG Project