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

    snapin and batch script

    Scheduled Pinned Locked Moved Unsolved
    FOG Problems
    6
    54
    20.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.
    • P
      plegrand @Avaryan
      last edited by

      @Avaryan it’s for use WsusOffline which is installed on a samba share \samba\wsus
      then i need to mount the wsus share , launch a command (wsus command) dnd then umount share.

      Tom ElliottT AvaryanA 2 Replies Last reply Reply Quote 0
      • Tom ElliottT
        Tom Elliott @Avaryan
        last edited by

        @Avaryan Slight correction, as the drive being mounted is “system wide” it will “appear” as the drive letter being mounted, but the credentials are not available to any user but the one who established the mount.

        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

        P 1 Reply Last reply Reply Quote 0
        • P
          plegrand @Tom Elliott
          last edited by

          @Tom-Elliott OK i understand
          Then no solution ?

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

            @plegrand So if you mount the drive, and in the same script run the action needed, things should work. You wouldn’t be able to make the mount->use another user to perform the action->then unmount.

            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

            P 1 Reply Last reply Reply Quote 0
            • AvaryanA
              Avaryan @plegrand
              last edited by Avaryan

              @plegrand said in snapin and batch script:

              @Avaryan it’s for use WsusOffline which is installed on a samba share \samba\wsus
              then i need to mount the wsus share , launch a command (wsus command) dnd then umount share.

              Ok. That should be possible since the local users don’t need to access the mount. Should be pretty easy in PowerShell. I don’t know how to do it other ways, lol.

              $Username = "Domain\User"
              $Password = "Password" | ConvertTo-SecureString -AsPlainText -Force
              $Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Username, $Password
              # Add share.
              New-PSDrive -Name "MyShare" -PSProvider FileSystem -Root \\ShareName\ -Credential $Credential
              
              # Do something...
              # More somethings...
              
              Remove-PSDrive -Name "MyShare"
              
              P 1 Reply Last reply Reply Quote 0
              • P
                plegrand @Tom Elliott
                last edited by plegrand

                @Tom-Elliott Here is what i need to do and which doesn’ works :

                net use * /delete /y >> %tmp%\Update_Windows7.log 2>&1
                net use z: \\samba\wsus$ "my'password" /user:samba\administrateur >> %tmp%\Update_Windows7.log 2>&1
                z:\wsusoffline\client\UpdateInstaller.exe >> %tmp%\Update_Windows7.log 2>&1
                net use /delete * /y >> %tmp%\Update_Windows7.log 2>&1
                

                UpdateInstaller.exe isn’t launched

                Tom ElliottT 1 Reply Last reply Reply Quote 0
                • P
                  plegrand @Avaryan
                  last edited by

                  @Avaryan As you can see , i need to mount the share and execute a command which is inside this share…
                  Then i thin it’s not possible ?

                  AvaryanA 1 Reply Last reply Reply Quote 0
                  • AvaryanA
                    Avaryan @plegrand
                    last edited by Avaryan

                    @plegrand said in snapin and batch script:

                    @Avaryan As you can see , i need to mount the share and execute a command which is inside this share…
                    Then i thin it’s not possible ?

                    Should be possible.

                    $Username = "samba\administrator"
                    $Password = "my'password" | ConvertTo-SecureString -AsPlainText -Force
                    $Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Username, $Password
                    
                    New-PSDrive -Name "Samba" -PSProvider FileSystem -Root '\\samba\wsus$' -Credential $Credential
                    $UpdateInstaller = Get-ChildItem -Path "Samba:\wsusoffline\client\" | Where-Object -Property Name -EQ "UpdateInstaller.exe"
                    Start-Process -FilePath $UpdateInstaller.FullName -Wait
                    Remove-PSDrive -Name "Samba"
                    

                    Depending on how large the UpdateInstaller.exe is and how many devices you are doing at once, it might be better to have this copy it over and run locally.

                    P 2 Replies Last reply Reply Quote 0
                    • Tom ElliottT
                      Tom Elliott @plegrand
                      last edited by

                      @plegrand Does the UpdateInstaller.exe require User input?

                      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
                      • P
                        plegrand @Avaryan
                        last edited by

                        @Avaryan then i use your ps script as a powershell template into snapin ?
                        thanks i try

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

                          @plegrand I still doubt if that will work. If UpdateInstaller.exe requires user input, the script won’t run (or will be stuck running forever).

                          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

                          P 1 Reply Last reply Reply Quote 0
                          • P
                            plegrand @Tom Elliott
                            last edited by

                            @Tom-Elliott i’m testing the ps script, but i cant understand why it could works better than a batch script which make the same thing

                            Tom ElliottT 1 Reply Last reply Reply Quote 0
                            • P
                              plegrand @Avaryan
                              last edited by

                              @Avaryan it doesn’ works, the share is not mounted at all

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

                                @plegrand I’m asking if UpdateInstaller.exe (as you’re running it) expects user input?

                                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

                                P 1 Reply Last reply Reply Quote 0
                                • P
                                  plegrand @Tom Elliott
                                  last edited by plegrand

                                  @Tom-Elliott In fact i will not use “UpdateInstaller.exe” IRl. I will use a command line with arguments like that :

                                  "call W:\cmd\DoUpdate.cmd /verify /updatecpp /updatetsc /instdotnet4 /autoreboot"
                                  

                                  But this command doesnt open a window then for my test i cant see if the command is well launched or not.

                                  But for the moment my problem is : how mount a samba share with snapin which is usable by administrator user

                                  Tom ElliottT AvaryanA 2 Replies Last reply Reply Quote 0
                                  • Tom ElliottT
                                    Tom Elliott @plegrand
                                    last edited by

                                    @plegrand You can’t. Not with snapins in that sense. It will be mounted by the SYSTEM user only as that’s how snapins run.

                                    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

                                    P 1 Reply Last reply Reply Quote 0
                                    • AvaryanA
                                      Avaryan @plegrand
                                      last edited by

                                      @plegrand said in snapin and batch script:

                                      But for the moment my problem is : how mount a samba share with snapin which is usable by administrator user

                                      What version of Windows would this Snapin be run on?

                                      P 1 Reply Last reply Reply Quote 0
                                      • P
                                        plegrand @Tom Elliott
                                        last edited by plegrand

                                        @Tom-Elliott may be with psexec tool ?
                                        For the moment i cant make it works syntax problem but with snapin pack ?

                                        Tom ElliottT 1 Reply Last reply Reply Quote 0
                                        • P
                                          plegrand @Avaryan
                                          last edited by

                                          @Avaryan Windows 7 and Windows 10

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

                                            @plegrand I am pretty sure, no amount of tries (with or without) snapin pack, snapin plain, psexec, powershell, batch, vbscript, or any thing else will get this working for you.

                                            The first step would be to find out if the command is actually needing user input. Snapins cannot operate with the user 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! 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

                                            P 1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 1 / 3
                                            • First post
                                              Last post

                                            150

                                            Online

                                            12.0k

                                            Users

                                            17.3k

                                            Topics

                                            155.2k

                                            Posts
                                            Copyright © 2012-2024 FOG Project