locked
How to get the device name?

    Question

  • How do we get the users device name from a WinJS app? We need that for our online registration service.
    Thursday, February 23, 2012 2:09 PM

Answers

  • You cannot get the MAC address (MAC address is a better but not a permanent id either).  You can get the hostname of the computer by inspecting this return array:

    Windows.Networking.Connectivity.NetworkInformation.GetHostNames()

    I would recommend  some other scheme if you want some sort of registration.  What are you trying to accomplish with the registration?

    -Jeff


    Jeff Sanders (MSFT)

    Friday, February 24, 2012 6:30 PM
    Moderator

All replies

  • I have no idea what a device name is.  Could you tell me what it means to you?

    Jeff Sanders (MSFT)

    Thursday, February 23, 2012 8:25 PM
    Moderator
  • The name that I have to enter during the Installation of Windows 8. In old Windows 7 it was called "computer name" I think Windows 8 calls it "Device name" during the Installation.
    Thursday, February 23, 2012 9:35 PM
  • Device names can change...wouldn't you want something more static like a MAC address?
    Friday, February 24, 2012 5:03 PM
  • Well yeah, maybe I could combine a MAC Address with the device name. The question remains: How do I read out those values from WinJS apps?

    I need to display the device name somewhere so if it changes I would match the MAC address and know its still the same machine.

    Friday, February 24, 2012 5:24 PM
  • You cannot get the MAC address (MAC address is a better but not a permanent id either).  You can get the hostname of the computer by inspecting this return array:

    Windows.Networking.Connectivity.NetworkInformation.GetHostNames()

    I would recommend  some other scheme if you want some sort of registration.  What are you trying to accomplish with the registration?

    -Jeff


    Jeff Sanders (MSFT)

    Friday, February 24, 2012 6:30 PM
    Moderator
  • For this purpose you can get ASHWID unique identifier other than MAC address.

    More details on http://msdn.microsoft.com/en-us/library/windows/apps/jj553431.aspx

    Thanks,

    Sree

    • Proposed as answer by sreejith.k Tuesday, August 21, 2012 11:34 PM
    Tuesday, August 21, 2012 11:34 PM