I'm trying to capture a registry value to tell if a user is signed into Onedrive. No matter what I do, it wont read the key. getVariable("Registry Value", "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\personal\", "reg_expand_sz", "All Operating Systems", "Halt on Fail")We are trying to either capture that string value so it can be referenced in a view via an advanced filter, or if the expected text exists put "true" in the column. Basically If that registry key contains the value "OneDrive - companyname", we want t be able to filter against it (vs people that just have it installed but not signed in/configured) I know the value is there and correct because I can run reg query using the string and it returns the value I expect.
You can only read the correct "current user" if you are logged in as that user. HKCU is referenced dynamically based on the current user account - you can't read that structure from another user or as SYSTEM because you have your own HKCU.
You can run a command in the user's context to get the value.
You can try impersonating the user, but that means you'll need their creds - probably not doable.
If you know the user's SID, you can try reading HKU instead.
I have a procedure for this that works for us (returning the values to custom system fields)
Let me know if you have trouble getting the xml attached.
Procedure UserID - From OneDrive.xml