Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: wntRunAsUser
(The UserName and Password are replaced with a Domain Admin Account)
AddExtender("WWWNT34I.DLL") UserName = "xxxx" UserPWD = "xxxx" UserDomain = "UK" Process = "Q:\MCWS32.NEW\Setup.exe" RetVal = wntRunAsUser(UserDomain,UserName,UserPWD, 2, 0) Run(Process, "")Even if I run the script whilst I am logged in I get the same error, and I am a Domain Admin. I am very keen to get this working, it will solve a BIG headache for us! Any help/advice would be much appreciated.
RetVal = wntRunAsUser(UserDomain,UserName,UserPWD, 2, 0)to
RetVal = wntRunAsUser(UserDomain,UserName,UserPWD, 2, 1)it should work.
I added the required user rights to Domain Users via the User Manager on the local workstation and this now seems to have got past the initial problem.
I also changed the last flag for wntRunAsUser to 1 as suggested.
The problem I have now is a little strange. If I simply use the Run command in the script, i.e.
Run("c:\install\setup.exe", "")The setup runs OK but fails (obviously) due to lack of user rights. However if I include the rest of the script, as in..
AddExtender("WWWNT34I.DLL") UserName = "xxx" UserPWD = "xxx" UserDomain = "UK" RetVal = wntRunAsUser(UserDomain, UserName, UserPWD, 2, 1) Run("c:\install\setup.exe", "").. Noting actually happens when it reaches the Run command. I added the DEBUG(@ON) option, and wntRunAsUser returns a value of 1, as does the Run command, but noting happends?! Any ideas anyone?
Otherwise I suspect some kind of weird environment issue.
AddExtender("WWWNT34I.DLL") ;Add required Network Extender Module ;Define Impersonation parameters for wntRunAsUser domain="" user="" password="" errormode(@off) impersonate = wntRunAsUser(domain, user, password, 2, 0) ;Start impersonating a local administrator errormode(@cancel) wdrive = wntGetCon("W:") ;find out what W: is connected to. pdrive = wntGetCon("P:") ;find out what P: is connected to.
Article ID: W14270
Filename: wntRunAsUser Function - 2.txt
File Created: 2001:03:01:14:20:18
Last Updated: 2001:03:01:14:20:18