Question

I want to get the computer user profile name to put log text on the appData

note: This is just for IE, (currently using this for windows 7 gadget)

The default would be, without profile name is this

C:/Users/user/AppData/Local/sampleFolder/

but when there is a profile name on it, what should it be?

C:/Users/{profileName}/AppData/Local/sampleFolder/

My fixed solution (but I recommend the accepted answer)

function GetComputerName()
{
    try
    {
        var network = new ActiveXObject('WScript.Network');
        // Show a pop up if it works
        alert(network.computerName);
    }
    catch (e) { }
}
Was it helpful?

Solution

I believe that would just be the users name, which should be:

network.username

This page looks like a guide to the object you are creating (for future reference).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top