When I have tried to get the username using below code, I have successfully get the user name:
hres = pSvc->GetObject(L"Win32_SID.SID='S-1-5-82-1036420768-1044797643-1061213386-2937092688-4282445334'", 0, NULL, &pclsObj, NULL);
But when assign the SID into variable as follows
std::string SID = "S-1-5-82-1036420768-1044797643-1061213386-2937092688-4282445334";
hres = pSvc->GetObject(L"Win32_SID.SID=SID", 0, NULL, &pclsObj, NULL);
then I got the following error:
Connected to root\CIMV2 WMI namespace
GetObject failed Error code = 0x8004103a
IDispatch error #3642
Could you please suggest me the correct input in GetObject method.