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

    Create Basic Snapin

    Scheduled Pinned Locked Moved
    General
    3
    4
    504
    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.
    • R
      rodrigonm
      last edited by

      Re: Snapin not working properly
      I have created a snapin like this and it is not working against multiple computers:

      Snapin General

      Snapin Name NpmInstall
      Snapin Description
      Snapin Type
      Snapin Template
      Snapin Run With cmd.exe
      Snapin Run With Argument
      runas.exe /user:heritage1\csteacher /c
      Snapin File
      Max Size: 3000M
      npm_install_fix.bat
      Snapin File (exists)
      Snapin Arguments
      Snapin Protected
      Snapin Enabled
      Snapin Arguments Hidden
      Snapin Timeout (seconds)
      0
      Replicate?
      Reboot after install
      Shutdown after install
      Snapin Command
      read-only
      cmd.exe runas.exe /user:heritage1\csteacher /c npm_install_fix.bat
      Make Changes?

      The script follows as:

      npm config set registry http://registry.npmjs.org/ --global
      npm cache clear --force
      npm install --verbose
      

      Any discrepancy found in this setup?

      Thank you for any help!

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

        On each of the machines you’re wanting this snapin to run on, does the npm executable exist?

        As you’re expecting it to run as a specific user, does that user not have a password?

        Is there a reason you are using the runas command?

        As you’re using the --global option in npm, wouldn’t it make more sense to just run the batch file as the system user (which is the context the snapin is going to attempt to run the runas command from?)

        So I would suggest, start simple first. Remove the Runas.exe and even the /user:heritage1\csteacher as that’s adding a level of complexity I don’t think is needed.

        I would highly suggest ensuring the npm command exists on the machines you’re expecting to run this.

        I would also suggest updating the batch script to directly call the npm binary. Right now, the way your batch file is written, it expects the npm to be set in system path. If you know it’s installed in C:\npm\npm.bat I would suggest updating the batch to use the direct path for the npm binary itself:

        c:\npm\npm.bat config set registry http://registry.npmjs.org/ --global
        c:\npm\npm.bat cache clear --force
        c:\npm\npm.bat install --verbose
        

        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
        • S
          Sebastian Roth Moderator
          last edited by

          @rodrigonm said in Create Basic Snapin:

          I have created a snapin like this and it is not working against multiple computers:

          Can you be more precise on where you see it doesn’t work? Please take a look at the fog.log file on the computers and post that here.

          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
          • R
            rodrigonm
            last edited by

            @Tom-Elliott said in Create Basic Snapin:

            batch script to directly call the npm binary. Right now, the way your batch file is written, it expects the npm to be set in system path. If you know it’s installed in C:\npm\npm.bat I would

            Thank you @Tom-Elliott and @Sebastian-Roth. It worked as regular user not as administrator.
            I have used another solution that is psexec that is a tool that runs the script at all the machines.

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

            198

            Online

            12.0k

            Users

            17.3k

            Topics

            155.2k

            Posts
            Copyright © 2012-2024 FOG Project