Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Auto start in standard account without UAC
#1
Hi all,

I never use the admin account and always use the standard account for my day to day activities. Adding HWiNFO to my startup will always ask for admin password since it requires elevated privileges. I wanted to bypass the UAC prompt and spent some time on this topic. Its very difficult but I came across a program called "runasspc" which will store your admin password encyrpted and then during startup, can run HWiNFO during standard login. More research indicated that the program uses the Win32 API, CreateProcessWithLogonW(). Note: There is a slight element of risk since admin password is in clear text when this API will be called. Anyway, "runasspc" satisfied my needs but sometimes it would randomly pop a dialog about its free license. So I decided to write a simple program myself that would start HWiNFO using same API.

I looked at the MSDN example for CreateProcessWithLogonW() and after lots of trials and errors and research, I was able to run HWiNFO as an admin from standard account without password. The trick was to use cmd.exe to start the program. Here is the program I used:

// runasadmin.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <Windows.h>
#include <stdio.h>
#include <UserEnv.h>

void DisplayError(LPWSTR pszAPI)
{
LPVOID lpMsgBuf;

FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR)&lpMsgBuf, 0, NULL);
wprintf(L"API = %s, Error code=%d, msg=%s\n", pszAPI, GetLastError(), (LPWSTR)lpMsgBuf);
LocalFree(lpMsgBuf);
ExitProcess(GetLastError());
}

int _tmain(int argc, _TCHAR* argv[])
{
PROCESS_INFORMATION pi = { 0 };
STARTUPINFO si = { 0 };
WCHAR szUser[256] = L"admin"; //account that has elevated privileges
WCHAR szDomain[256] = L"domain";
WCHAR szPass[256] = L"password";
WCHAR szApp[256] = L"cmd.exe /C start \"\" D:\\HWiNFO64\\HWiNFO64.exe";
WCHAR szDir[256] = L"D:\\HWiNFO64\\";

si.cb = sizeof(STARTUPINFO);

if (!CreateProcessWithLogonW(szUser, szDomain, szPass, LOGON_WITH_PROFILE,
NULL, szApp, CREATE_UNICODE_ENVIRONMENT, NULL,
szDir, &si, &pi)) {
DisplayError(L"CreateProcess");
}

CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
return 0;
}


Compile and put this in your startup path and you will be able to run HWiNFO from standard account without password. Make changes as necessary.

Note: As seen above, the password is in clear text. So use it at your own risk.

Thanks,
- Arun
Reply
#2
Thanks for your suggestion.
However I don't understand why you don't use the "Auto Start" feature built in HWiNFO. That creates a new task in the Windows Task Scheduler, which allows to run HWiNFO with Administrator rights and bypassing the UAC prompt. You can also customize this task properties in the Task Scheduler (start conditions, timing, user account, etc).
Reply
#3
Hi Martin,

The Task scheduler trick works only for Administrator accounts. If you log in to admin account, yes, there are no issues. It doesn't work for standard user logins. At least, it never worked for me and after much trial and error, I have done what I mentioned above.

Thanks,
- Arun

PS: If anyone was able to use a standard user account for starting up HWiNFO without password, and can share the steps, that would be great!
Reply
#4
Have you tried to change the user of the task? If you enable Auto Start in HWiNFO, press OK and then go into Task Scheduler and try to "Change User or Group..." under Security options.
Reply
#5
Yes, I had tried all that. Changing the user will start the HWiNFO task when you login with the following error:

"Cannot install HWiNFO driver! Check user rights and anti-virus filters"

This is the same error you get when you double-click HWiNFO in standard user account without "run as admin"
Reply
#6
Hm, you might try to run as Admin the first time and use the Persistent Driver option.
Reply
#7
Tongue 
(12-19-2014, 05:37 PM)akr16 Wrote: Adding HWiNFO to my startup will always ask for admin password since it requires elevated privileges.
Using Standard Account too..
With latest HWiNFO v. 5.07- 2670, adding HWiNFO to my Standard Account startup folder isn't asking for admin password anymore.. at least for me Tongue



(12-19-2014, 07:19 PM)Martin Wrote: .. use the "Auto Start" feature built in HWiNFO. That creates a new task in the Windows Task Scheduler, which allows to run HWiNFO with Administrator rights and bypassing the UAC prompt. You can also customize this task properties in the Task Scheduler (start conditions, timing, user account, etc).
use Auto Start feature, but HWiNFO  task only running for Administrator Account. Login to Standard Account  doesn't trigger running HWiNFO (not even on the list of Standar Account Task Scheduler).
I have to manually create second HWiNFO task for my Standard Acccount.
Reply
#8
(11-07-2015, 05:56 AM)wawans1975 Wrote: use Auto Start feature, but HWiNFO  task only running for Administrator Account. Login to Standard Account  doesn't trigger running HWiNFO (not even on the list of Standar Account Task Scheduler).
I have to manually create second HWiNFO task for my Standard Acccount.

You might need to adjust the task in Task Scheduler, by default it's configured to require Administrative rights (Run with highest privileges).
Reply
#9
(11-07-2015, 09:02 AM)Martin Wrote:
(11-07-2015, 05:56 AM)wawans1975 Wrote: use Auto Start feature, but HWiNFO  task only running for Administrator Account. Login to Standard Account  doesn't trigger running HWiNFO (not even on the list of Standar Account Task Scheduler).
I have to manually create second HWiNFO task for my Standard Acccount.

You might need to adjust the task in Task Scheduler, by default it's configured to require Administrative rights (Run with highest privileges).

Work ok now, I've adjust HWiNFO task  that have been created by HWiNFO to use Users Account and leave Run Highest Privileges checked. A combination of those work for my system Big Grin under Administrator Account and Standard Account that I have.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)