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

Run basic batch script on client machine via snapin

Scheduled Pinned Locked Moved
General
3
13
3.3k
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
    msi Testers
    last edited by Sep 19, 2017, 5:02 PM

    How can add and deploy basic batch via snapin from fog server? I was planning to run below batch script: (inside the script)
    net user test password /add
    net user test1 /delete
    wmic computersystem where name=“%computername%” call rename name=“abc-Win10”

    W 1 Reply Last reply Sep 21, 2017, 11:34 PM Reply Quote 0
    • G
      george1421 Moderator
      last edited by Sep 19, 2017, 5:09 PM

      I don’t use snapins but its pretty easy to import the batch script and make a snapin.

      just save your code into a batch file, lets say configsys.cmd

      Add those lines in like this"

      @echo off
      net user test password /add
      net user test1 /delete
      wmic computersystem where name="%computername%" call rename name=“abc-Win10”
      

      Then save the batch file.
      Goto the new snapin page and set the snapin template to Batch script and then upload your script.

      That one is one of the simplest ones to create.

      I would wonder if you are doing this after the fact, because there are ways to do this via the unattend.xml or fog client that might be easier then doing it post imaging.

      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!

      M 1 Reply Last reply Sep 19, 2017, 5:12 PM Reply Quote 0
      • M
        msi Testers @george1421
        last edited by msi Sep 19, 2017, 11:15 AM Sep 19, 2017, 5:12 PM

        @george1421 Please don’t take me wrong. I thought batch file should be saved as .bat format. Also, I am not familiar with unattend.xml. Would you be able to show me how? This is after the fact that user has moved to another desk and we have to add new user on that PC.

        G 1 Reply Last reply Sep 19, 2017, 6:42 PM Reply Quote 0
        • G
          george1421 Moderator @msi
          last edited by Sep 19, 2017, 6:42 PM

          @msi Sorry maybe I wasn’t clear. Your batch file route can be saved as a .bat (but is probably better saved as a .cmd). You can deploy that as a snapin just as I had outlined.

          The second part of my comment was to the reason why you are doing this. If you have to fix 100 computers that have already been deployed then the snap in route is the correct one. If you are doing this because you will deploy 100 computers in the future, then there may be another path you can take. One example is if you sysprep your reference image, then you can place batch commands in the c:\windows\setup\scripts directory. After windows setup is done, and before the login screen is presented to the user, windows setup looks in that path for a batch file called setupcomplete.cmd. If it finds that file it will run it before the user can login. There is also a way to have the windows unattend.xml file run commands or add users during its execution. Which can do the same things you are doing in your batch file.

          These are all different ways to get the same results. The simplest is to create a batch file snapin like you talked about.

          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!

          M 1 Reply Last reply Sep 21, 2017, 8:22 PM Reply Quote 0
          • M
            msi Testers @george1421
            last edited by Sep 21, 2017, 8:22 PM

            @george1421 just ran the snapin. it is not working… I checked the fog log, it saying some sort of Middleware response error. It just has a pause icon as below:
            0_1506024885176_91b48b8c-8686-4592-bba0-ea073e317395-image.png

            G 1 Reply Last reply Sep 21, 2017, 8:25 PM Reply Quote 0
            • G
              george1421 Moderator @msi
              last edited by Sep 21, 2017, 8:25 PM

              @msi I guess you need to post the errors in the log since the batch file is pretty simple. The developers may have to look into what is generating the middleware error.

              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!

              M 1 Reply Last reply Sep 21, 2017, 8:35 PM Reply Quote 0
              • M
                msi Testers @george1421
                last edited by Sep 21, 2017, 8:35 PM

                @george1421 how can I do that?

                G 1 Reply Last reply Sep 21, 2017, 8:41 PM Reply Quote 0
                • G
                  george1421 Moderator @msi
                  last edited by Sep 21, 2017, 8:41 PM

                  @msi You looked in the fog client log [fog.log] to see the middle ware error on the client computer?

                  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!

                  M 1 Reply Last reply Sep 21, 2017, 9:13 PM Reply Quote 0
                  • M
                    msi Testers @george1421
                    last edited by msi Sep 21, 2017, 3:14 PM Sep 21, 2017, 9:13 PM

                    @george1421 I looked at the client (Karim-Win10) machine and c:\ drive. I guess, it’s a different issue. Should I start a new discussion?

                    1 Reply Last reply Reply Quote 0
                    • W
                      Wayne Workman @msi
                      last edited by Sep 21, 2017, 11:34 PM

                      @msi said in Run basic batch script on client machine via snapin:

                      wmic computersystem where name=“%computername%” call rename name=“abc-Win10”

                      I’m curious why you’d want to run the above command that I quoted. The FOG Client already will rename the system if you update the hostname in the web gui.

                      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/

                      M 1 Reply Last reply Sep 22, 2017, 1:51 PM Reply Quote 0
                      • M
                        msi Testers @Wayne Workman
                        last edited by Sep 22, 2017, 1:51 PM

                        @wayne-workman I didn’t know that it could do that. Does it restart the machine afterwards? How can I verify that it changed the host name?

                        W 1 Reply Last reply Sep 22, 2017, 3:54 PM Reply Quote 0
                        • W
                          Wayne Workman @msi
                          last edited by Wayne Workman Sep 22, 2017, 9:54 AM Sep 22, 2017, 3:54 PM

                          @msi said in Run basic batch script on client machine via snapin:

                          Does it restart the machine afterwards?

                          Yes. There’s options on how long the grace time for rebooting is, and the user has the option to cancel the reboot and then it’d just happen whenever it happens.

                          How can I verify that it changed the host name?

                          The new name will appear in Active Directory - and the computer will have a new name, so on… The rename feature is rock-solid, you don’t need to worry about checking on it. As long as the client-server encryption isn’t broke and the client can talk to the server, it’ll happen.

                          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/

                          M 1 Reply Last reply Sep 22, 2017, 4:47 PM Reply Quote 0
                          • M
                            msi Testers @Wayne Workman
                            last edited by Sep 22, 2017, 4:47 PM

                            @wayne-workman Just tried, it works! 🙂 thanks

                            1 Reply Last reply Reply Quote 0
                            • 1 / 1
                            1 / 1
                            • First post
                              3/13
                              Last post

                            204

                            Online

                            12.0k

                            Users

                            17.3k

                            Topics

                            155.2k

                            Posts
                            Copyright © 2012-2024 FOG Project