?
Solved

VBScript to install SNMP on Remote computer

Posted on 2011-05-05
18
Medium Priority
?
1,408 Views
Last Modified: 2012-05-11
I would like to use the script shown in this link:
http://classictriple.com/scripting-snmp-installation/

for instance , I have a remote server name MYSERVER and want to install SNMP service  and configure the Trap .

I have downloaded PSTOOLS to my workstation.
what do I need to change on the script in order to install the SNMP on  the remote server MYSERVER?

Thanks
0
Comment
Question by:jskfan
  • 10
  • 8
18 Comments
 
LVL 65

Expert Comment

by:RobSampson
ID: 35705172
According to the example usage, you don't need to change anything, you just use PSExec to run the following command:

psexec \\MYSERVER -u domain\username -p Password cmd.exe /c \\YourFileServer\SharePath\SNMPInstall.vbs /path:\\YourFileServer\i386FolderShare /community:public

Then, it would install on MYSERVER, by running the script located at \\YourFileServer\SharePath, using \\YourFileServer\i386FolderShare as the source for the i386 folder.

Regards,

Rob.
0
 

Author Comment

by:jskfan
ID: 35717753
when I run it it shows this error
cmd.exe exited on remotehostname  with error code 1.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 35717775
What if you run:
psexec \\MYSERVER -u domain\username -p Password cmd.exe /c wscript.exe \\YourFileServer\SharePath\SNMPInstall.vbs /path:\\YourFileServer\i386FolderShare /community:public

If you have spaces in your paths, you'll need:
psexec \\MYSERVER -u domain\username -p Password cmd.exe /c wscript.exe "\\YourFileServer\SharePath\SNMPInstall.vbs" /path:"\\YourFileServer\i386FolderShare" /community:public

Regards,

Rob.
0
2017 Webroot Threat Report

MSPs: Get the facts you need to protect your clients.
The 2017 Webroot Threat Report provides a uniquely insightful global view into the analysis and discoveries made by the Webroot® Threat Intelligence Platform to provide insights on key trends and risks as seen by our users.

 

Author Comment

by:jskfan
ID: 35718928
I am getting this error now:

\\YourFileServer\SharePath\SNMPINSTALL.vbs(3, 27) Microsoft VBScript compilation err
or: Invalid character

cmd.exe exited on hpsim with error code 1.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 35719355
Hmmm, I'd have to see what line 3 in your VBS file is....
0
 

Author Comment

by:jskfan
ID: 35722659
http://classictriple.com/scripting-snmp-installation/

the same script as the one on the link above
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 35725037
Oh, I see....sorry about that....

OK, throughout that script you'll see that the double quote symbols are all slanted.  They need to be replaced with the standard double quote character of "

Do a find and replace on the whole script changing “ with "

Regards,

Rob.
0
 

Author Comment

by:jskfan
ID: 35736559
I am getting this error now.
cmd.exe exited on hpsim with error code 1.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 35743308
OK, PSExec won't be able to tell us what the error is.  If you run it manually on a machine using this command:
wscript.exe "\\YourFileServer\SharePath\SNMPInstall.vbs" /path:"\\YourFileServer\i386FolderShare" /community:public

does it come up with an error somewhere?  What line does it say the error is on?

Rob.
0
 

Author Comment

by:jskfan
ID: 35745176
OK..
I will try to run the script locally on the computer without using Psexec, in order to isolate the probable Psexec issue root cause.
I will do it later and let you know,
0
 

Author Comment

by:jskfan
ID: 35745247

I did run it, all I got is the part pasted below. This part is a text written inside the script itself.


C:\Pstools>snmpinstall.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

********************************************************************************
************************************
 Run using cscript

 Usage: SNMPInstall.vbs /path /server /community /perm

 Arguments Needed

 /path: Path to i386 folder of a Windows Install Disk, Place on a share
 Make sure to name the folder i386 and define the path as \\servername\rootfolde
r\ do not use the i386 folder in the path
 /server: Authorized SNMP Server Name or IP Address
 /community: SNMP Community Names to be added
 /access: Permissions levels for SNMP communitity, Use r for read, rw for read w
rite, or n for no access.
 Default Setting is Read. If no variable is passed, the default will be used.
 /reg: This will change the registry value for Authorized Servers. By defualt th
e first Authorized manager is localhost at #1 in the registry.
 This Script will replace the #2 registry value by default unless specified here
.
********************************************************************************
************************************
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 35751330
Hi, you forgot to add the arguments for the script.  Run it using:
wscript.exe "\\YourFileServer\SharePath\SNMPInstall.vbs" /path:"\\YourFileServer\i386FolderShare" /server:10.0.0.1 /community:public

making sure you specify the i386 path, the authorized SNMP server, and the community option.

The server is actually required, so if it works manually, the PSExec command would be:
psexec \\MYSERVER -u domain\username -p Password cmd.exe /c wscript.exe "\\YourFileServer\SharePath\SNMPInstall.vbs" /path:"\\YourFileServer\i386FolderShare" /server:10.0.0.1 /community:public

Regards,

Rob.
0
 

Author Comment

by:jskfan
ID: 35763619
Actually I did that in purpose.
After I got this error:
cmd.exe exited on hpsim with error code 1.

I said to myself let me run the script that only installs SNMP service without configuring the public community string, so I truncated the second part of the script that I thought It is used to configure the public community string.

I could be wrong
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 2000 total points
ID: 35774555
The script is designed to display the "usage" screen if the /path, /server, and /community parameters are not given so at least those three parameters must be given for the script to run.

In my original suggestion, I forgot the /server parameter, so you actually need to use:
psexec \\MYSERVER -u domain\username -p Password cmd.exe /c wscript.exe "\\YourFileServer\SharePath\SNMPInstall.vbs" /path:"\\YourFileServer\i386FolderShare" /server:10.0.0.1 /community:public

Regards,

Rob.
0
 

Author Comment

by:jskfan
ID: 35783697
I get this error:

cmd.exe exited on Remotehost with error code -1073741502.
0
 

Author Comment

by:jskfan
ID: 35783733
I am running psexec against windows 2008 R2 64bit
0
 
LVL 65

Assisted Solution

by:RobSampson
RobSampson earned 2000 total points
ID: 35784117
Wow, I've never seen that error, but from a search, it looks like a compiler bug check, which suggests that PSExec cannot execute against Server 2008 R2 64-bit.

However, it might be as simple as having to call a specific version of wscript.exe (32 or 64 bit)

Try this manually on the server:
 c:\window\system32\wscript.exe "\\YourFileServer\SharePath\SNMPInstall.vbs" /path:"\\YourFileServer\i386FolderShare" /server:10.0.0.1 /community:public

or
c:\windows\syswow64\wscript.exe "\\YourFileServer\SharePath\SNMPInstall.vbs" /path:"\\YourFileServer\i386FolderShare" /server:10.0.0.1 /community:public

and see which one works.

Rob.
0
 

Author Closing Comment

by:jskfan
ID: 35800564
I will try it later...
Thanks
0

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use of TCL script on Cisco devices:  - create file and merge it with running configuration to apply configuration changes
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question