0 out of 2 rated this helpful - Rate this topic

GetExpandedStringValue method of the StdRegProv class

The GetExpandedStringValue method returns the data value for a named value whose data type is REG_EXPAND_SZ.

This topic uses Managed Object Format (MOF) syntax. For more information about using this method, see Calling a Method.

Syntax


uint32 GetExpandedStringValue(
  [in, optional]  uint32 hDefKey = HKEY_LOCAL_MACHINE,
  string sSubKeyName,
  string sValueName,
  string sValue
);

Parameters

hDefKey [in, optional]

A registry tree, also known as a hive, that contains the sSubKeyName path. The default value is HKEY_LOCAL_MACHINE.

Note that HKEY_DYN_DATA is a valid tree for computers running Windows 95 and Windows 98 only.

The following trees are defined in Winreg.h.

HKEY_CLASSES_ROOT (2147483648 (0x80000000))
HKEY_CURRENT_USER (2147483649 (0x80000001))
HKEY_LOCAL_MACHINE (2147483650 (0x80000002))
HKEY_USERS (2147483651 (0x80000003))
HKEY_CURRENT_CONFIG (2147483653 (0x80000005))
HKEY_DYN_DATA (2147483654 (0x80000006))
sSubKeyName

[in] A path that contains the named values.

sValueName

[in] A named value whose data value you are retrieving. Specify an empty string to get the default named value.

sValue

[out] An expanded string data value for the named value. The string is only expanded if the environment variable (for example, %Path%) is defined.

Examples

For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository. Other examples are in books and articles listed in Further Information.

For C++ code examples, see WMI C++ Application Examples.

The following VBScript code example shows how to read the REG_EXPAND_SZ value that is located in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon. You can save the script as a file with a .vbs extension and send the output to a file by executing the command line in the folder that contains the script:

cscript Filename.vbs > output.txt

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&_
    strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon"
strValueName = "UIHost"
Return = objReg.GetExpandedStringValue(HKEY_LOCAL_MACHINE,_
    strKeyPath,strValueName,strValue)
If (Return = 0) And (Err.Number = 0) Then   
    WScript.Echo  "The Windows logon UI host is: " & strValue
Else
    Wscript.Echo _
        "GetExpandedStringValue failed. Error = " & Err.Number
End If

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Namespace

\root\default

MOF

Regevent.mof

DLL

Stdprov.dll

 

 

Send comments about this topic to Microsoft

Build date: 11/19/2012

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.