First, find the user's SID (in string format). The method you use will vary depending on your programming language. However, here is one way to do this (VBScript):
'Note: you must have domain/corporate network connectivity in order to complete this query for a domain account 'This will not work for a remote user that is not connected via VPN, for example. strUserName = "flesniak" strNetBIOSDomainName = "DOMAIN" 'Use the computer name if checking local account Set objWMI = GetObject("winmgmts:\\.\root\cimv2") Set objAccount = objWMI.Get("Win32_UserAccount.Name='" & strUserName & "',Domain='" & strNetBIOSDomainName & "'") strUserSID = objAccount.SID
Once you have the SID, then query the registry key:
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\<SID>
and inspect the string value:
CentralProfile
If the CentralProfile value is blank or nonexistent, then it's a local profile. If CentralProfile is configured to be a UNC path, then it's a roaming profile.