Createprocesswithlogonw Failed With Error 1326
help) which logonuser failed with error code 1326 utilizes CreateProcessWithLogonW to execute a process with Administrator privileges on a network. I am currently trying to execute a command on a remote computer which is NOT PART OF A DOMAIN. When I do this, I am getting 1326 error on the LogonUser function when executing this program with its user/password parameters on a non-domain computer. For example, the application is executed in the following way: iedoz administrador@192.168.1.86 123456 "aprogram.exe" C:\Users\myuser>iedoz administrador@192.168.1.86 123456 "aprogram.exe" ERROR: API = LogonUser. error code = 1326. message = Logon failure: unknown user name or bad password . I would really appreciate it if you guys could help me because I am not too familiar with C++ and am not experienced in debugging with Visual Studio. This is my code. iedoz.cpp 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
17
1326 when starting VBS-File If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 2 of 2 Thread: CreateProcessWithLogonW() error 1326 when starting VBS-File Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Nov 12th, 2007,08:40 AM #1 simonster View Profile View Forum Posts http://www.cplusplus.com/forum/windows/131546/ Thread Starter New Member Join Date Nov 2007 Posts 2 CreateProcessWithLogonW() error 1326 when starting VBS-File Hi there I need to execute a VB-Script as a specific User. I use the RunAsUser()-function which you can find here. I execute it as following: Code: RunAsUser "user", "password", "mydomain", "\\chsfile01\Projects_Test\__Scripts\Project_NewCustomer.vbs", "" When executing this code, i get "CreateProcessWithLogonW() failed with error 1326". When i use an EXE-File instead of http://www.vbforums.com/showthread.php?496466-CreateProcessWithLogonW()-error-1326-when-starting-VBS-File a VBS it works fine. What can I do? Thanks in advance, Simon Reply With Quote Nov 12th, 2007,09:19 AM #2 simonster View Profile View Forum Posts Thread Starter New Member Join Date Nov 2007 Posts 2 Re: CreateProcessWithLogonW() error 1326 when starting VBS-File Sorry... the error-code i get is 193 (not a valid win32-process), not 1326 Reply With Quote Quick Navigation Visual Basic 6 and Earlier Top Site Areas Settings Private Messages Subscriptions Who's Online Search Forums Forums Home Forums Visual Basic Visual Basic .NET VB.net CodeBank Visual Basic 6 and Earlier CodeBank - Visual Basic 6 and earlier Modern Windows Experience (Metro) Office Development Mobile Development ASP, VB Script Database Development Reporting API Games and Graphics Programming Game Demos COM and ActiveX Network Programming Visual Basic FAQs Slow Chat with the Microsoft Visual Basic team .NET ASP.NET Visual Basic .NET MVC .Net C# WPF, WCF, WF Silverlight .NET Architecture and Design General General Developer Forum IoT, IoE, and Maker Forum Testers and Testing Application Testing Application Deployment Linux Development General PC VBForums Coding Contests Contest Entries Code It Better Maths Forum Other Languages Other BASIC C and C++ Java PHP XML, HTML, Javascript, Web and CSS jQuery
Studio 2015 products Visual Studio Team Services Visual Studio Code Visual Studio Dev https://msdn.microsoft.com/en-us/library/windows/desktop/ms682431(v=vs.85).aspx Essentials Office Office Word/Excel/PowerPoint Microsoft Graph Outlook OneDrive/Sharepoint Skype Services http://stackoverflow.com/questions/13199628/createprocesswithlogonw-unable-to-start-process Store Cortana Bing Application Insights Languages & platforms Xamarin ASP.NET C++ TypeScript .NET - VB, C#, F# Server Windows Server SQL Server BizTalk Server SharePoint Dynamics Programs & communities Students Startups Forums MSDN Subscriber downloads Sign in failed with Search Microsoft Search Windows Dev Center Windows Dev Center Explore What’s new for Windows 10 Intro to Universal Windows Platform Coding challenges Develop for accessibility Build for enterprise Windows Store opportunities Docs Windows apps Get started Design and UI Develop API reference Publish Monetize Promote Games failed with error Get started UI design Develop Publish Desktop Get started Design Develop API reference Test and deploy Compatibility Windows IoT Microsoft Edge Windows Holographic Downloads Samples Support Why Windows Dashboard Explore What’s new for Windows 10 Intro to Universal Windows Platform Coding challenges Develop for accessibility Build for enterprise Windows Store opportunities Docs Windows apps Get started Design and UI Develop API reference Publish Monetize Promote Games Get started UI design Develop Publish Desktop Get started Design Develop API reference Test and deploy Compatibility Windows IoT Microsoft Edge Windows Holographic Downloads Samples Support Why Windows Dashboard Processes and Threads Process and Thread Reference Process and Thread Functions Process and Thread Functions CreateProcessWithLogonW CreateProcessWithLogonW CreateProcessWithLogonW AssignProcessToJobObject AttachThreadInput AvQuerySystemResponsiveness AvRevertMmThreadCharacteristics AvRtCreateThreadOrderingGroup AvRtCreateThreadOrderingGroupEx AvRtDeleteThreadOrderingGroup AvRtJoinThreadOrderingGroup AvRtLeaveThreadOrderingGroup AvRtWaitOnThreadOrderingGroup AvSetMmMaxThreadCharacteristics AvSetMmThreadCharacteristics AvSetMmThreadPriority BindIoCompletionCallback CallbackMayRunLong CancelThreadpoolIo CleanupGroupCancelCallback CloseThreadpool CloseThreadpoolCleanupGroup CloseThreadpoolCleanupGroupMembers CloseThreadpoolIo CloseThreadpoolTimer CloseThreadpoolWait CloseThreadpoolWork Conve
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 minute: Sign up CreateProcessWithLogonW : unable to start process up vote 0 down vote favorite 1 Hi I am completely new to programming. And please someone help me. I am trying to start a pocess from a service. I need to start the new process by prompting user to enter admin credentials. I was trying to use CreateProcessWithLogonW(). Am I using the right function. I tried to give input username, password, domain as localhost. I gave full pathe to the .exe file that i need to start. Here is the piece of code. CreateProcessWithLogonW(L"Administrator", L"localhost", L"password", 0, NULL, L"c:\myupdates\myapp.exe", NORMAL_PRIORITY_CLASS | CREATE_CONSOLE, NULL, NULL, &si, &pi); Si.cb = sizeof(si); Si.lpDesktop = L"winsta0\\default"; But the process never started. Can you guys tell me what I am doing wrong. And what do I need to do to promt user to enter credentials of administrator instead of hardcoding it. c++ windows winapi windows-7 windows-services share|improve this question edited Nov 2 '12 at 16:59 hmjd 88.6k8115176 asked Nov 2 '12 at 16:47 Vivek 10629 What does GetLastError() say? –Benj Nov 2 '12 at 16:49 One thing you are doing wrong is assigning to the si structure after you call CreateProcessWithLogonW. You should do it before. –john Nov 2 '12 at 16:50 3 Is it me, or is proper usage of the Windows API CreateProcessWithLogin() and "I'm completely new to programming" somehow seem a little unnerving... –WhozCraig Nov 2 '12 at 16:54 I was assigning si structure before making this call. Does this function promts the user to enter the Administrator credentials –Vivek Nov 2 '12 at 16:54 Did you check the documentation of the very function you're calling? What does it say about admin-prompting? –WhozCraig Nov 2 '12 at 16:56 | show 2 more comments 5 Answers 5 active oldest votes up vote 1 down vote accepted None of CreateProcess* functions will do any promting. They are low level APIs and know nothing about GUI. If you want user to be prompted, use ShellExecuteEx with runas comm