if Impersonate("ProdAdmin", "ProdPassword") * I use a mapped drive just as an example, of course it is not needed or desireble USE X:\ProductFolder\Products endif * Do some process EndImpersonate() FUNCTION Impersonate(UserName As String, UserPassword As String) As Boolean LOCAL nToken, loNet Declare Integer LogonUser IN advapi32 ; String lpszUsername, ; String lpszDomain, ; String lpszPassword, ; Integer dwLogonType, ; Integer dwLogonProvider, ; Long @phToken Declare Integer ImpersonateLoggedOnUser IN WIN32API Long ptr Declare RevertToSelf IN ADVAPI32 nToken = 0 loNET = CREATEOBJECT('wscript.Network') IF LogonUser(UserName, loNET.UserDomain, UserPassword, 2, 0, @nToken) > 0 IF ImpersonateLoggedOnUser(nToken) > 0 CLEAR DLLS loNet.MapNetworkDrive('X:', '\\skyapps\apps') && Map all network drives is necessary RETURN .t. ENDIF ENDIF CLEAR DLLS RETURN .F. ENDFUNC FUNCTION EndImpersonate() As Boolean Declare RevertToSelf IN ADVAPI32 RevertToSelf() CLEAR DLLS ENDFUNCNow the code between Impersonate() and EndImpersonate() would have the rights of the user passed as parameter. Note that this can be dangerous, for example if you open explorer while impersonating (within the program, for the impersonation is just scoped to the vfp session), the user would have all rights of the impersonated user.