Create Basic Snapin
Re: Snapin not working properly
I have created a snapin like this and it is not working against multiple computers:
Snapin Name NpmInstall
Snapin Run With cmd.exe
Snapin Run With Argument
runas.exe /user:heritage1\csteacher /c
Max Size: 3000M
Snapin File (exists)
Snapin Arguments Hidden
Snapin Timeout (seconds)
Reboot after install
Shutdown after install
cmd.exe runas.exe /user:heritage1\csteacher /c npm_install_fix.bat
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!
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
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