Click here to Skip to main content
15,882,152 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
We have executed the below query from the C# code when logged in with a Microsoft account on Windows 8.1 PC.
Quote:
(get-wmiobject Win32_ComputerSystem –ComputerName "<user pc="" name="">").UserName

We have received the below Answer.
Quote:
Lenovo-Pc/user.@outlook.com>

But, our user in the market got the below response.
Quote:
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.

What is the PC condition that causes the WMI to give the strange answer for UserName query?

Appreciate any quick response.
Thank you very much.

What I have tried:

We have tried to rename the PC name. After renaming the PC, the response is proper.
Posted
Updated 29-Apr-19 21:49pm
v3
Comments
Richard MacCutchan 30-Apr-19 3:45am    
That just looks like a fully qualified name. You need to check the settings on the user's PC.
vijayalakshmi dasari 2-May-19 3:46am    
"That just looks like a fully qualified name. You need to check the settings on the user's PC"

Which settings? Kindly reply.

1 solution

See Power shell commands returning the improper user name format[^].

Are you the same person that posted the reference question?
 
Share this answer
 
v2
Comments
vijayalakshmi dasari 30-Apr-19 5:43am    
No.
The suggestion in link is not my answer even.

This issue is related to WMI ->WIn32_ComputerSystem- implementation which occurs with Microsoft account on Windows 8.1 only.



Richard MacCutchan 30-Apr-19 6:02am    
Quite a coincidence that it's exactly the same question. Had you googled, you would have found it for yourself.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900