On 18 October 2010 19:39, Ghelani Hinesh <[email protected]> wrote:
> I am attempting to make the (snmpwalk process run silently so I am using the 
> following code)

> sComputer = "."
> Set objWMIService = GetObject("winmgmts:" & 
> "{impersonationLevel=impersonate}!\\" & sComputer & "\root\cimv2")
> Const HIDDEN_WINDOW = 5 ‘ ************* this value should be 12 (run in a 
> process that is hidden from the user. 5 is normal operations as in visible
> Set objStartup = objWMIService.Get("Win32_ProcessStartup")
> Set objConfig = objStartup.SpawnInstance objConfig.ShowWindow = HIDDEN_WINDOW
> Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
> errReturn = objProcess.Create("snmpwalk.exe  -v 2c -c dashisto" & " 
> 192.168.12.34 " &   " 1.3.6.1.2.1.2.2.1.7 " & ">" & 
> """C:\WINDOWS\system32\zzzzzzzzz.txt""")
> MSGBOX errReturn
>
>
>
> And the vbscript works except that the output is not being generated at 
> C:\WINDOWS\system32\zzzzzzzzz.txt


Does the "snmpwalk.exe" command work as expected if run from a command prompt?
If so, then this isn't really anything to do with the Net-SNMP project
- it's a generic
question of how to use Win32_Process.Create and output redirection.

A quick Google for "win32_process create redirect" threw up the link
    
http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/1f28f5e9-412b-4a96-a3df-b31a9cb217e2

which might be relevant for you.
If that doesn't help, then try asking on a Microsoft development forum.
They're more likely to know how to do this sort of redirection than we are.


Dave


DISCLAIMER
  The information and material in this email is intended for the use of anyone
   who might find it useful  It contains no privileged or confidential
information
   nor any copyright material.

   If you receive this email by mistake, please do *NOT* advise the sender, who
   quite frankly couldn't care less.

   Any views or opinions expressed are solely those of the author and do not
   represent the view [why not "views" plural?] of the University of Liverpool,
   which knows nothing about the existence or contents of this email message,
   or about SNMP at alll - but fortunately does not enforce the use of stupid
   and inappropriate disclaimers on outgoing email.

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to