• 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!


  • @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.

  • Senior Developer

    @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.

  • Senior Developer

    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
    

311
Online

7.7k
Users

14.7k
Topics

138.5k
Posts