#88095 - 2002-09-20 04:34 PM
Re: WMI caller credentials
|
Breaker
Hey THIS is FUN
   
Registered: 2001-06-15
Posts: 268
Loc: Yorkshire, England
|
A word of warning. Thought the ConnectServer method will work when connecting to WMI on a remote host, if you attempt to specify a different username and password when connecting to the local machine's WBEM repository, the call will fail. This is from the SDK documentation:
quote: SWbemLocator.ConnectServer The ConnectServer method of the SWbemLocator object connects to the namespace on the computer specified in the strServer parameter. This can be either a local or remote target computer, typically with a Microsoft® Windows NT®/Windows® 2000 or Microsoft® Windows® 95/98 operating system. The target computer must have WMI installed. If the method is successful, an SWbemServices object is returned that is bound to the namespace on the host computer.
The following syntax is language neutral. For an explanation of this syntax, see Document Conventions.
objwbemServices = objwbemLocator.ConnectServer( [strServer=""], [strNameSpace=""], [strUser=""], [strPassword=""], [strLocale=""], [strAuthority=""], [iSecurityFlags=0], [objwbemNamedValueSet=null] ); Parameters strServer Optional. For access to a remote computer using DCOM, 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 has been configured as the default namespace for scripting. For more information on the default value for this parameter, see Object Creation and Monikers. strUser Optional. String that specifies the user name to use while attempting to connect. This can be in the form of a user name or Domain\Username. Leave it blank to use the current logged-on user name. 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. strPassword Optional. String that specifies the password to use when attempting to connect. Leave it blank to use the password of the current logged-on user. 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. 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 in which information should 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, NTLM authentication is used and this parameter should contain an NTLM domain name. If you leave this parameter blank the operating system negotiates with DCOM 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. For more information see Using Kerberos or NTLM Authentication with the Scripting API for more information. iSecurityFlags Optional. Reserved and must be zero if specified. 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.
_________________________
================================================ Breaker
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
1 registered
(Allen)
and 267 anonymous users online.
|
|
|