Taconvino
asked on
Impersonate user with VBScript
Hi,
I need to impersonate a domain user from VBScript. The reason is I need to move some files from the server the script is runnin in to another server, and the logged on user on the first server has no permissions to create files in the shared folder. There's no way network admins will change this... any help will be greatly appriciated.
Thanks!
TCV
I need to impersonate a domain user from VBScript. The reason is I need to move some files from the server the script is runnin in to another server, and the logged on user on the first server has no permissions to create files in the shared folder. There's no way network admins will change this... any help will be greatly appriciated.
Thanks!
TCV
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That's a great idea dlwyatt82! I'll get back to you as soon as I test this.
TCV
TCV
ASKER
Sorry dlwyatt82.... I'm getting some "conflicting credentials" error...
TCV
TCV
that means you already have a drive mapped to that particular server with a different user name / password combination. Unfortunately Windows doesn't allow for that... you'd need to unmap whatever your existing drive is first.
ASKER
Yes, that's probably the case, but I can't unmap any existing mappings, as this server runs different processes for different systems.
Anyway, both solutions provided here work under certain conditions, and since I'm using RUNAS anyway, I'm splitting points between both experts that helped me out here!
Just for future reference, there's another solution that involves creating a DLL to impersonate a user. This is done by calling three APIs:
ImpersonateLoggedOnUser
LogonUser
RevertToSelf
This is a little more complex, and requires certain privileges for the user trying to impersonate another to be granted (secpol).
Thanks a lot for your help!
TCV
Anyway, both solutions provided here work under certain conditions, and since I'm using RUNAS anyway, I'm splitting points between both experts that helped me out here!
Just for future reference, there's another solution that involves creating a DLL to impersonate a user. This is done by calling three APIs:
ImpersonateLoggedOnUser
LogonUser
RevertToSelf
This is a little more complex, and requires certain privileges for the user trying to impersonate another to be granted (secpol).
Thanks a lot for your help!
TCV
ASKER
TCV