I am working on Universal Application for windows 8.x Using the UserInformation Class I am able to find Domain, Principal, User Name.... But I need to get PC name like (ACER-PC) from system Information.
Environment.MachineName, NetworkInformation.GetHostNames() these two are not working for me.
How can i get it in Universal windows Application.
Thanks
First of all, the Universal Windows Platform (UWP) is only supported on Windows 10. For Windows 8.1, there was the notion of a "Universal app" that was the same source code built into two different packages one for Windows Store 8.1 and the other for Windows phone 8.1, but it has nothing really to do with the "Universal Windows Platform". In fact, in a UWP app you cannot use UserInformation
at all. See MSDN for details. You can only get limited information from User
for privacy reasons in a UWP.
By design most system-specific information is hidden in both Windows 8.1 Store apps and Universal Windows Platform (UWP) apps which is why Environment.MachineName
fails. You can use the EasClientDeviceInformation
class, the AnalyticsInfo
class, and the User
class to get some information but not "Domain", "Principle", or "User name".
So the real question is: Why do you want the machine name and what do you think you need to use it for?