Answered How to get the device name?

  • 2012年2月23日 14:09
     
     
    How do we get the users device name from a WinJS app? We need that for our online registration service.

全部回复

  • 2012年2月23日 20:25
    版主
     
     建议的答复
    I have no idea what a device name is.  Could you tell me what it means to you?

    Jeff Sanders (MSFT)

  • 2012年2月23日 21:35
     
     
    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.
  • 2012年2月24日 17:03
     
     
    Device names can change...wouldn't you want something more static like a MAC address?
  • 2012年2月24日 17:24
     
     

    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.

  • 2012年2月24日 18:30
    版主
     
     已答复

    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)

  • 2012年8月21日 23:34
     
     建议的答复

    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

    • 已建议为答案 sreejith.k 2012年8月21日 23:34
    •