none
Strange answer to WMI query for user name in Microsoft account on windows 8.1 RRS feed

  • Question

  • Hi,
    We have executed the below query from the C# code when logged in with a Microsoft account on Windows 8.1 PC.
    (get-wmiobject Win32_ComputerSystem –ComputerName "<user pc="" name="">").UserName
    We have received the below Answer.
    Lenovo-Pc/user.@outlook.com>
    But, our user in the market got the below response.
    Lenovo-Pc/LENOVO-PC/user.@outlook.com>

    This strange answer is received on Microsoft account in Windows 8.1.
    Due to this our code failed.
    Which PC setting causes the WMI to give the strange answer for UserName query?
    Appreciate any quick response.
    Thank you very much.
    Tuesday, April 30, 2019 4:27 AM

All replies

  • Hello sharp1257,

    This forum is for "Discuss general issues about developing applications for Windows." It is win32/C++ focused.

    Since your issue is C# related I'll move it to the right forum for more professional support.

    Best regards,

    Rita


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, April 30, 2019 6:51 AM
  • Thanks.

    Though we have used C# code, the issue is related to Windows 8.1 and WMI.

    C# does not have any significance.

    If required, please move it to a forum where OS behavior can be discussed.

    E.g: Windows 8.1+WMI

    Tuesday, April 30, 2019 6:54 AM
  • Hi sharp1257,

    Thank you for posting here.

    For your question, could you provide the c# code for us to test the WMI query?

    And sorry for that, we could not move it to a forum related Windows, you could post a new thread in Windows forum in the link below.

    https://answers.microsoft.com/en-us/windows/forum/windows8_1?sort=LastReplyDate&dir=Desc&tab=All&status=all&mod=&modAge=&advFil=&postedAfter=&postedBefore=&threadType=all&isFilterExpanded=false&page=1

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, May 1, 2019 5:22 AM
    Moderator
  • It is not dependent on C# code.

    Issue occurs when the below WMI query is executed from powershell.

    (get-wmiobject Win32_ComputerSystem –ComputerName "<user pc="" name="">").UserName

    Please note that the issue is neither related to powershell nor c#. It is related to WMI implementation on Windows 8.1 for Microsoft Account.

    Thursday, May 2, 2019 7:42 AM
  • Hi sharp1257,

    But we are not good at powershell, for the query in powershell, powershell forum would give you a good solution.

    It would be better to ask your query in this forum.

    https://social.technet.microsoft.com/Forums/en-US/home?forum=winserverpowershell

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, May 3, 2019 3:12 AM
    Moderator
  • Thanks.

    Could you provide the forum link to post questions about WMI?

    Friday, May 3, 2019 3:45 AM