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

    Help with creating a PowerShell Snapin

    Scheduled Pinned Locked Moved
    FOG Problems
    8
    20
    8.7k
    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
      BigMan99211
      last edited by

      I have a PS script that is ready to deploy, but I can’t seem to get it to push to a machine.

      Does anyone know what to enter in the snapin creation, to get a .ps1 file to copy and run on a machine?

      "Failure is not an option. It come pre-installed on Windows…" - Anonymous

      "Life is hard; It's harder if you're stupid" - John Wayne

      1 Reply Last reply Reply Quote 0
      • B
        BigMan99211
        last edited by

        Tried using SFX Maker, but FOG isn’t pushing it to the machine…

        "Failure is not an option. It come pre-installed on Windows…" - Anonymous

        "Life is hard; It's harder if you're stupid" - John Wayne

        1 Reply Last reply Reply Quote 0
        • B
          BigMan99211
          last edited by

          Ok I’m going to just keep posting until someone helps me out here… :rolleyes:

          All I need to know is what to enter to get a single power shell script to push out to a machine via snapin, and run on said machine…

          "Failure is not an option. It come pre-installed on Windows…" - Anonymous

          "Life is hard; It's harder if you're stupid" - John Wayne

          1 Reply Last reply Reply Quote 0
          • Tom ElliottT
            Tom Elliott
            last edited by

            if you know the powershell commands, maybe create a bat or cmd file that calls powershell to run the scripts you need?

            I don’t know that powershell will run natively from cmd prompt which is how most things run in the Snapin Client part of things.

            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
            • Jaymes DriverJ
              Jaymes Driver Developer
              last edited by

              I don’t use Snap ins or Power Shell, I am of no use to you.

              WARNING TO USERS: My comments are written completely devoid of emotion, do not mistake my concise to the point manner as a personal insult or attack.

              1 Reply Last reply Reply Quote 0
              • B
                BigMan99211
                last edited by

                @Tom - Can said bat or cmd just be uploaded to FOG, or do I have to encapsulate it first?

                Basically, what i’ve done is, made a PS script that sends an “Invoke-Command” to a server that I have PDQ Deploy (a software deployment system) running on. The invoke-command tells PDQ Deploy to run and deploy a specific software package to the machine that the PS script originally ran from. So, once it’s set up as a snapin, I can image, rename, join to domain, and deploy any software package to any/all of my PCs.

                Then, taking if further, I want to eventually set up a daily recurring script that checks PDQ Deploy’s Package Library, for specific software updates. Once it finds one, it will download the package, and somehow notify FOG to Wake on LAN all machines, then invoke the deploy command to all machines in a specific IP range. This would essentially make Full Zero Touch with Automatic Updates! 🆒

                "Failure is not an option. It come pre-installed on Windows…" - Anonymous

                "Life is hard; It's harder if you're stupid" - John Wayne

                1 Reply Last reply Reply Quote 0
                • A
                  Albatros
                  last edited by

                  FOG can run batch files, no need to create a exe file for that. I however create a exe file If I have more than 1 file to run.

                  1 Reply Last reply Reply Quote 0
                  • BigDawg986B
                    BigDawg986
                    last edited by

                    [quote=“Albatros, post: 24014, member: 16710”]FOG can run batch files, no need to create a exe file for that. I however create a exe file If I have more than 1 file to run.[/quote]

                    I have a lot of batch files. I use psexec to push them to all my hosts to deploy software etc. Can someone tell me how to use these batch files as a FOG snap-in?

                    1 Reply Last reply Reply Quote 0
                    • A
                      Albatros
                      last edited by

                      Do you know this tutorial?
                      [url]http://fogproject.org/forum/threads/how-to-make-a-simple-snapin-start-to-finish.304/[/url]

                      With the help of the tutorial you can make a exe file that contains a 7-zip file and this file contains batch files.

                      1 Reply Last reply Reply Quote 0
                      • B
                        BigMan99211
                        last edited by

                        Thanks for the post Albatros. I did already see that. It needs a little updating though, as the guide is following an older version, and they’ve changed the interface a little. But, overall I still got it to work. I now have a full zero touch deployment system with deployment of any software package I choose.

                        My next goal is to make a script that will check daily for Flash and Java updates. When it finds one, the plan is to have the script change out the existing installer with the new one, then somehow notify FOG to reset the snapin deployment to all machines in a group. This should essentially create a sort of Auto Updater…

                        "Failure is not an option. It come pre-installed on Windows…" - Anonymous

                        "Life is hard; It's harder if you're stupid" - John Wayne

                        1 Reply Last reply Reply Quote 0
                        • B
                          BigMan99211
                          last edited by

                          OOOHH… Just had an epiphany as 5am… 😄

                          Better yet, I’ll just have a machine group set up in PDQ Deploy, with all of the same machines that are in the FOG group. This way, I can just have the script talk directly to the PDQ Deploy machine group, instead of going all the way out and through FOG.

                          "Failure is not an option. It come pre-installed on Windows…" - Anonymous

                          "Life is hard; It's harder if you're stupid" - John Wayne

                          1 Reply Last reply Reply Quote 0
                          • B
                            Bob Henderson
                            last edited by

                            [quote=“BigMan99211, post: 24135, member: 21932”]OOOHH… Just had an epiphany as 5am… 😄

                            Better yet, I’ll just have a machine group set up in PDQ Deploy, with all of the same machines that are in the FOG group. This way, I can just have the script talk directly to the PDQ Deploy machine group, instead of going all the way out and through FOG.[/quote]

                            Any more updates at this? I’ve just got the script working to pull updates from PDQDeploy on the machine, but am wondering how to fire it off after an image. Are you still using a snappin, or something different? I’d love to get this r unning, as I’ve got 1200 machines to image next month…

                            1 Reply Last reply Reply Quote 0
                            • B
                              Bob Henderson
                              last edited by

                              [quote=“Bob Henderson, post: 47213, member: 1291”]Any more updates at this? I’ve just got the script working to pull updates from PDQDeploy on the machine, but am wondering how to fire it off after an image. Are you still using a snappin, or something different? I’d love to get this r unning, as I’ve got 1200 machines to image next month…[/quote]

                              And yes, thread necro, but for relevance!

                              1 Reply Last reply Reply Quote 0
                              • Wayne WorkmanW
                                Wayne Workman
                                last edited by

                                If you have a domain, there is zero reasons to “Deploy” a powershell script.

                                Powershell can control domain-connected clients like puppets. You can literally push out whatever you want to whatever computer you want, instantly, from powershell itself on a DC.

                                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
                                • B
                                  Bob Henderson
                                  last edited by

                                  [quote=“Wayne Workman, post: 47235, member: 28155”]If you have a domain, there is zero reasons to “Deploy” a powershell script.

                                  Powershell can control domain-connected clients like puppets. You can literally push out whatever you want to whatever computer you want, instantly, from powershell itself on a DC.[/quote]

                                  Completely understood. Problem is, I’m doing something a bit different. To lay it out easily:

                                  1. I create a base image (Windows 7 + Office2013) and get it all sysprepped and into FOG.
                                  2. I deploy base image to various hardware.
                                  3. I have this script to invoke a deployment job using PDQ deploy to install the rest of my packages in their updated versions.

                                  I’d love to get it so that that script fires off automatically. Problem is, since it’s powershell using WinRM to invoke the PDQ Deploy command, I need to be domain joined. If I’m not mistaken, this puts adding the script to the SetupComplete.cmd file out of the question, as the domainjoin from FOG hasn’t ran yet.

                                  Any suggestions?

                                  1 Reply Last reply Reply Quote 0
                                  • Wayne WorkmanW
                                    Wayne Workman
                                    last edited by

                                    I suppose you could use the “RunOnce” registry value, and put a batch script on the image. You can raise elevation within a batch script, and then run a powershell script from that.

                                    The pointer will point to a network share where your actual script is, perhaps copy it down and run it locally.

                                    But yeah you’re right, without being joined to the domain… you have to do other things. I used to to something similar to the above back in college, but using nothing but batch files. It worked really well, long as the share path and remote script name never changed; which wasn’t an issue.

                                    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
                                    • B
                                      Bob Henderson
                                      last edited by

                                      Would run once work with domain join/rename bit of Fog? I’m worried that with the fact it usually gets to a login before domain join, then reboots, it would run and then fail.

                                      1 Reply Last reply Reply Quote 0
                                      • Wayne WorkmanW
                                        Wayne Workman
                                        last edited by

                                        [quote=“Bob Henderson, post: 47245, member: 1291”]Would run once work with domain join/rename bit of Fog? I’m worried that with the fact it usually gets to a login before domain join, then reboots, it would run and then fail.[/quote]

                                        No way to know but to try…

                                        Set the FOG Client Service to delayed start?

                                        You could also try a startup-script. You can set this via Local Group Policy on the image itself. Then, to get rid of it later once it’s on the domain, you can set policy to get rid of it on your DC.

                                        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
                                        • B
                                          Bob Henderson
                                          last edited by

                                          Sadly, tried that, no luck. Since it’s a powershell script, it really needs the domain to be working well, which means I cant have it on RunOnce registry unless I could somehow get that key added after the domainjoin task.

                                          Startupscript via local group policy is an option I’ll be trying today. I’d just need to set the last step of the task to delete the script…

                                          I’m honestly wondering how BigMan99211 got it working up there, and was hoping he’d chime in!

                                          1 Reply Last reply Reply Quote 0
                                          • d4rk3D
                                            d4rk3
                                            last edited by

                                            1. Re-package your desired software that you normally deploy with PDQ deploy into MSI’s (test all of them to confirm they install correctly).
                                            2. Create Snapins and have them auto-deploy when desired.
                                            3. ???
                                            4. Profit!
                                            1 Reply Last reply Reply Quote 1
                                            • 1 / 1
                                            • First post
                                              Last post

                                            232

                                            Online

                                            12.0k

                                            Users

                                            17.3k

                                            Topics

                                            155.2k

                                            Posts
                                            Copyright © 2012-2024 FOG Project