WMI Доступ к маршрутизатору
Модератор: Модераторы
1 сообщение
• Страница 1 из 1
Всем привет
Помогите разобраться с одной задачей.
Нужно обратится к маршрутизатору и сосчитать одну из МИБ-таблиц.
Используя VBScript.
SnmpUser = "Х.Х.Х.Х" && (мой IP)
SnmpDevice = "Y.Y.Y.Y" && (IP маршрутизатора)
SnmpPassw = "Password" && (Выделенный мне CommunityName)
oSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
objWmiServices = oSWbemLocator.ConnectServer(m.SnmpDevice, '', m.SnmpUser, m.SnmpPassw, '', '', 0, .NULL.)
Вот тут возникает проблема с доступом.
oNetAdapt = objWmiServices.Get('SNMP_RFC1213_MIB_ifTable')
Возможно нужно заполнять и другие параметры ConnectServer?
Формат ConnectServer
objwbemServices = ConnectServer( [ strServer = "" ], [ strNamespace = "" ],
[ strUser = "" ], [ strPassword = "" ], [ strLocale = "" ], [ strAuthority = "" ],
[ iSecurityFlags = 0 ], [ objwbemNamedValueSet = null ]
Parameters
strServer
[optional] For access to a remote computer using the Component Object Model (COM), this parameter specifies the computer name. One example is myserver. If you do not provide this parameter the call defaults to the local computer.
strNamespace
[optional] String that specifies the namespace to which you log on. For example, to log on to the root\default namespace, use root\default. If you do not specify this parameter, it defaults to the namespace that is configured as the default namespace for scripting. For more information, see Creating a WMI Application or Script.
strUser
[optional] String that specifies the user name to use to connect. The string can be in the form of a user name or Domain\Username. Leave this parameter blank to use the current security context. The strUser parameter should only be used with connections to remote WMI servers. If you attempt to specify strUser for a local WMI connection, the connection attempt fails. If Kerberos authentication is in use, then the username and password specified in strUser and strPassword cannot be intercepted on a network.
Windows XP: You can use UPN format to specify the strUser for example, UserName@DomainName.
Note If a domain is specified in strAuthority, then the domain must not be specified here. Specifying the domain in both parameters results in an Invalid Parameter error.
strPassword
[optional] String that specifies the password to use when attempting to connect. Leave the parameter blank to use the current security context. The strPassword parameter should only be used with connections to remote WMI servers. If you attempt to specify strPassword for a local WMI connection, the connection attempt fails. If Kerberos authentication is in use then the username and password specified in strUser and strPassword cannot be intercepted on the network.
strLocale
[optional] String that specifies the localization code. If you want to use the current locale, leave it blank. If not blank, this parameter must be a string that indicates the desired locale where information must be retrieved. For Microsoft locale identifiers, the format of the string is "MS_xxxx", where xxxx is a string in hexadecimal form that indicates the LCID. For example, American English would appear as "MS_409".
strAuthority
[optional] If the strAuthority parameter begins with the string "kerberos:", Kerberos authentication is used and this parameter should contain a Kerberos principal name. If the strAuthority parameter contains any other value, NT Lan Manager (NTLM) authentication is used, and this parameter should contain an NTLM domain name. If you leave this parameter blank the operating system negotiates with COM to determine whether NTLM or Kerberos authentication is used. This parameter should only be used with connections to remote WMI servers. If you attempt to set the authority for a local WMI connection, the connection attempt fails. .
Note If the domain is specified in strUser, which is the preferred location, then it must not be specified here. Specifying the domain in both parameters results in an Invalid Parameter error.
iSecurityFlags
[optional] Used to pass flag values to ConnectServer. A value of 0 for this parameter results in the call to ConnectServer returning only after connection to the server is established. This could result in your program hanging indefinitely if connection cannot be established for any reason. The following table describes the other values for iSecurityFlags. Flag Meaning
wbemConnectFlagUseMaxWait
128
0x80 The ConnectServer call is guaranteed to return in 2 minutes or less. Use this flag to prevent your program from hanging indefinitely if connection cannot be established for any reason.
objwbemNamedValueSet
[optional] Typically, this is undefined. Otherwise, this is an SWbemNamedValueSet object whose elements represent the context information that can be used by the provider that is servicing the request. A provider that supports or requires such information must document the recognized value names, data type of the value, allowed values, and semantics.
Помогите разобраться с одной задачей.
Нужно обратится к маршрутизатору и сосчитать одну из МИБ-таблиц.
Используя VBScript.
SnmpUser = "Х.Х.Х.Х" && (мой IP)
SnmpDevice = "Y.Y.Y.Y" && (IP маршрутизатора)
SnmpPassw = "Password" && (Выделенный мне CommunityName)
oSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
objWmiServices = oSWbemLocator.ConnectServer(m.SnmpDevice, '', m.SnmpUser, m.SnmpPassw, '', '', 0, .NULL.)
Вот тут возникает проблема с доступом.
oNetAdapt = objWmiServices.Get('SNMP_RFC1213_MIB_ifTable')
Возможно нужно заполнять и другие параметры ConnectServer?
Формат ConnectServer
objwbemServices = ConnectServer( [ strServer = "" ], [ strNamespace = "" ],
[ strUser = "" ], [ strPassword = "" ], [ strLocale = "" ], [ strAuthority = "" ],
[ iSecurityFlags = 0 ], [ objwbemNamedValueSet = null ]
Parameters
strServer
[optional] For access to a remote computer using the Component Object Model (COM), this parameter specifies the computer name. One example is myserver. If you do not provide this parameter the call defaults to the local computer.
strNamespace
[optional] String that specifies the namespace to which you log on. For example, to log on to the root\default namespace, use root\default. If you do not specify this parameter, it defaults to the namespace that is configured as the default namespace for scripting. For more information, see Creating a WMI Application or Script.
strUser
[optional] String that specifies the user name to use to connect. The string can be in the form of a user name or Domain\Username. Leave this parameter blank to use the current security context. The strUser parameter should only be used with connections to remote WMI servers. If you attempt to specify strUser for a local WMI connection, the connection attempt fails. If Kerberos authentication is in use, then the username and password specified in strUser and strPassword cannot be intercepted on a network.
Windows XP: You can use UPN format to specify the strUser for example, UserName@DomainName.
Note If a domain is specified in strAuthority, then the domain must not be specified here. Specifying the domain in both parameters results in an Invalid Parameter error.
strPassword
[optional] String that specifies the password to use when attempting to connect. Leave the parameter blank to use the current security context. The strPassword parameter should only be used with connections to remote WMI servers. If you attempt to specify strPassword for a local WMI connection, the connection attempt fails. If Kerberos authentication is in use then the username and password specified in strUser and strPassword cannot be intercepted on the network.
strLocale
[optional] String that specifies the localization code. If you want to use the current locale, leave it blank. If not blank, this parameter must be a string that indicates the desired locale where information must be retrieved. For Microsoft locale identifiers, the format of the string is "MS_xxxx", where xxxx is a string in hexadecimal form that indicates the LCID. For example, American English would appear as "MS_409".
strAuthority
[optional] If the strAuthority parameter begins with the string "kerberos:", Kerberos authentication is used and this parameter should contain a Kerberos principal name. If the strAuthority parameter contains any other value, NT Lan Manager (NTLM) authentication is used, and this parameter should contain an NTLM domain name. If you leave this parameter blank the operating system negotiates with COM to determine whether NTLM or Kerberos authentication is used. This parameter should only be used with connections to remote WMI servers. If you attempt to set the authority for a local WMI connection, the connection attempt fails. .
Note If the domain is specified in strUser, which is the preferred location, then it must not be specified here. Specifying the domain in both parameters results in an Invalid Parameter error.
iSecurityFlags
[optional] Used to pass flag values to ConnectServer. A value of 0 for this parameter results in the call to ConnectServer returning only after connection to the server is established. This could result in your program hanging indefinitely if connection cannot be established for any reason. The following table describes the other values for iSecurityFlags. Flag Meaning
wbemConnectFlagUseMaxWait
128
0x80 The ConnectServer call is guaranteed to return in 2 minutes or less. Use this flag to prevent your program from hanging indefinitely if connection cannot be established for any reason.
objwbemNamedValueSet
[optional] Typically, this is undefined. Otherwise, this is an SWbemNamedValueSet object whose elements represent the context information that can be used by the provider that is servicing the request. A provider that supports or requires such information must document the recognized value names, data type of the value, allowed values, and semantics.
1 сообщение
• Страница 1 из 1
Вернуться в Сети и сетевые технологии, сетевое оборудование.
Кто сейчас на конференции
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 0