System.Environment.machineName property

[The Windows Gadget Platform/Sidebar is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. ]

Gets the name of the local computer.

This property is read-only.

Syntax

strmachineName = System.Environment.machineName

Property value

A String that receives the name of the local computer.

Remarks

The value of strMachineName is the same as the value of the COMPUTERNAME environment variable.

Examples

The following example demonstrates how to get the value of the COMPUTERNAME environment variable.

// --------------------------------------------------------------------
// Set the text of the gadget based on the environment variable.
// --------------------------------------------------------------------
function SetContentText()
{
    txtMachineName.innerHTML = System.Environment.machineName;
    var environmentVariableValue = 
        System.Environment.getEnvironmentVariable(environmentVariableName);
    
    if (environmentVariableValue)
    {
        gadgetContent.innerHTML = environmentVariableName + 
            ": " + environmentVariableValue;
    }
    else
    {
        gadgetContent.innerHTML = defaultText;
    }
}

Requirements

Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
End of client support
Windows 7
End of server support
Windows Server 2008
IDL
Sidebar.idl
DLL
Sidebar.Exe (version 1.00 or later)

See also

Reference

System.Environment

getEnvironmentVariable