Error Loading User Profile. 1314
View previous topicView next topic Runas Utility Author Message splasshh Joined: 07 Feb 2012Posts: 5Country: Singapore Runas Utility Hi, I'm using this RunAs utility to automate simple "copy" batch job with admin privilege, but encounter error. Code: Runas "domain\admin" adminpwd copy O:\logo.jpg C:\Windows\web\wallpaper\logo.jpg The errors are: Setting user environment... Error #1314 loading user profile! Error ignored. Error #203 setting user environment! Error ignored. Logged in. Impersonating... Starting process copy... Error #2: The system cannot find the file specified. I'm not sure why it prompts "cannot find the file" while it's obviously there. O:\ is our shared drive. running the Quote: copy O:\logo.jpg C:\Windows\web\wallpaper\logo.jpg manually with admin account logged on, works fine. appreciate some pointers. Thanks. Tue Feb 07, 2012 3:50 am SysOp Site Admin Joined: 26 Nov 2006Posts: 6035 O:\logo.jpg - seems to point to a mapped drive name, mapped for your account, not for domain\admin. Try Runas.exe "domain\admin" adminpwd copy \\some_server\some_volume\logo.jpg C:\Windows\web\wallpaper\logo.jpg Tue Feb 07, 2012 5:41 pm splasshh Joined: 07 Feb 2012Posts: 5Country: Singapore wow.. good catch.. O:\ is indeed a mapped drive with normal user account. However, I tried Runas.exe "domain\admin" adminpwd copy \\some_server\some_volume\logo.jpg C:\Windows\web\wallpaper\logo.jpg it doesn't work still, with the same error message. pls help.. Wed Feb 08, 2012 12:09 am SysOp Site Admin Joined: 26 Nov 2006Posts: 6035 Sorry, another oversight. "copy" is not an executable file name, it is an extension command for cmd.exe, that command works only from the command prompt or if passed as a parameter to cmd.exe. Runas.exe "domain\admin" adminpwd xcopy \\some_server\some_volume\logo.jpg C:\Windows\web\wallpaper\logo.jpg or Runas.exe "domain\admin" adminpwd cmd /C copy \\some_server\some_volume\logo.jpg C:\Windows\web\wallpaper\logo.jpg Wed Feb 08, 2012 2:41 am splasshh Joined: 07 Feb 2012Posts: 5Country: Singapore I found that in some other forum and tried xcopy and cmd /c copy, but still same error :( Setting user environment... Error #1314 loading user profile! Error ignored. Error #203 setting user environment! Error ignored. Logged in. Impersonating... Starting process cmd... Error #2: The system cannot find the file specified. When I put the /V option it reported as "successfully" but still no file copied. Runas.exe "domain\admin" adminpwd /V xcopy \\some_se
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a http://www.softtreetech.com/support/phpBB2/viewtopic.php?p=27262&sid=10a043de5fe6957ab5b7be72f49ea696 minute: Sign up LoadUserProfile not creating local user profile when it does not exist [C#] up vote 4 down vote favorite 1 I have a tool which I use to programmatically create local user accounts as follows: DirectoryEntry NewUser = dirEntryLocalMachine.Children.Add("UserName", "user"); NewUser.Invoke("SetPassword", new object[] { "Passsord" }); NewUser.Invoke("Put", new object[] { "Description", "Description" }); NewUser.CommitChanges(); The account is created fine http://stackoverflow.com/questions/1479511/loaduserprofile-not-creating-local-user-profile-when-it-does-not-exist-c but at at this point the User Profile does not exists (no HKEY CURRENT USER, no Documents & Settings, etc...), I was doing some research into this and found the following MSDN article that says calling LoadUserProfile(...) will actually create the profile if it does not exist: How To Programmatically Cause the Creation of a User's Profile So I added the code as follows: IntPtr hToken = IntPtr.Zero; bool bLogon = LogonUser( sName, sDomain, sPassword, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, out hToken ); PROFILEINFO profileInfo = new PROFILEINFO(); profileInfo.dwSize = Marshal.SizeOf(profileInfo); profileInfo.dwFlags = 1; profileInfo.lpUserName = sName; bool bLoad = LoadUserProfile(hToken, ref profileInfo); Now, both bLogon and bLoad are true, no exceptions occur, everything "seems" to work fine ... The contents of profileInfo are not updated (I would have assumed field like .lpProfilePath should have good values) and GetUserProfileDirectory() fails to find the path (obviously - it doesn't exist) - I also check manually and there is nothing under "documents & settings" for the new account. Anyone have any clues as to what I am doing wrong? Any help would be much appreciated. Thanks, c# shar