windows-services

How to auto login to windows account?

自作多情 提交于 2019-12-06 15:04:36
问题 I am researching ways to auto login to a windows server, so applications can be restarted on reboot if the server crashes. Do windows services load before or after a user logs in? Can a windows service be used to login to an account? If not, is there any way to use some sort of login script to facilitate automatically loggin in? 回答1: Services run regardless of whether a user logs on. If you need an application to run all the time, have you considered converting it to a service? Auto-logon is

How to debug windows service which fails in Init() method

你。 提交于 2019-12-06 14:17:57
I have a windows service which fails in Init() method and throws some exception , so only way for me to check what the error is by looking at the event log. I want to debug the windows service, but the problem is that i can attach debugger only when service is rnning, in my case it fails in Init() method only. Any idea ? you can programatically attach the debugger as the first line in the function: Debugger.Launch (); after adding the using statement: using System.Diagnostics; What I usually do is to have a class with a static void Main() entry point, which I can then temporarily assign in the

Capturing KeyPress Event in WIndow Service

梦想的初衷 提交于 2019-12-06 14:11:01
I am trying to create a window service to create a small keylogger application. I am new to Windows services and my sole purpose is to learn. How can I obtain all the events that are available in Winforms, but in a Windows service? I've tried searching on Google, but I'm unable to find out how to do this. I'm getting many references to keyhook DLLs. Windows Services are not form based therefore you cannot do it that way.... Have a look here for an example of how to create a Windows Service that kills other windows. A window service is not an ideal spot to place a form on... think of a daemon

How to know if a Windows session is an interactive one?

試著忘記壹切 提交于 2019-12-06 13:45:43
I'm creating a service that will run processes on user interactive session. I found how to start process from session 0 in a service, I found how to catch when a user is logged on. But I need to know if a Windows session is an interactive one or the list of interactive Windows sessions. First setup your interop declarations. This is the hardest part DllImport("secur32.dll", SetLastError = false)] private static extern uint LsaFreeReturnBuffer(IntPtr buffer); [DllImport("Secur32.dll", SetLastError = false)] private static extern uint LsaEnumerateLogonSessions (out UInt64 LogonSessionCount, out

How to know which Local Application Connected to my socket (Windows)

痞子三分冷 提交于 2019-12-06 12:27:33
I have a windows services that bind to some TCP port, this port is use for IPC between my application. Is there a programming (WinAPI/WinSocket and etc) way to know which application connected to my port? i.e. in my Windows Services I would like to get a PID of the process that connected to my port. If you're looking for WinAPI way of doing the same as netstat . You probably want the following API: GetExtendedTcpTable Look for the results with TCP_TABLE_OWNER_PID_ALL argument. The resulting MIB_TCPTABLE_OWNER_PID structure has many MIB_TCPROW_OWNER_PID structures that has dwOwningPid which is

How can I give a windows service access on a remote machine in case of Workgroup?

女生的网名这么多〃 提交于 2019-12-06 12:10:55
问题 I'm working on a Windows Service that one of its tasks is archiving files on remote machine but I've a problem regarding access privileges in case of Workgroup. 回答1: The simplest way is to mirror the username and password on both machines, creating the same account on both machines, then run your service under that account. As you're in a workgroup and not a domain the remote login will work, but once you're in a domain that no longer works. You cannot use any of the built in service accounts

.NET Windows Service - Architectural Decisions

心不动则不痛 提交于 2019-12-06 11:50:52
问题 I currently have a Windows Service which continually runs throughout the day. It has multiple threads which kick off: tasks daily to update cache tasks weekly to do cleanup 24/7 task to import XML into SQL Server tasks which run for around 12 hours per day kicking off a console application to manage ETL The tasks are not the important part of this question but it gives you the idea that this Windows service has grown to be a monster. It manages the imports of somewhere in the region of 300

Install/update driver from Windows service

99封情书 提交于 2019-12-06 11:37:55
问题 To install a driver, you typically send the command: DefaultInstall 128 {inf path} to the InstallHinfSection via direct call or RunDLL. This works wonderfully. I can install my driver anywhere (including 64-bit Win 2008 R2, which means I've got all the code signing right too). HOWEVER, the above fails when launched from a Windows service. I've read about service vs client installs, and hoped I had met all the requirements for a silent service install (built a .CAT file, it is signed along

Removing Windows Logon screen through a service

為{幸葍}努か 提交于 2019-12-06 11:30:46
问题 I am trying to remove the windows logon screen (winlogon) from an executable launched from a service. The service would start automatically with windows and wait for commands from another computer. When it receives a command, it will launch an exe which will start cmd.exe under a particular username. The service is already present. I have the job of writing this executable. Currently, I have written the executable (CmdLogin) which starts cmd.exe under a different user through calls to

How to configure IE proxying for the local system account? [closed]

倾然丶 夕夏残阳落幕 提交于 2019-12-06 11:25:17
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 8 years ago . See Server Fault: How do I configure proxy settings for LOCAL SYSTEM? I have a Windows service that needs to start up IE with certain proxy settings (e.g. host name and port). If the service is configured to run as some normal user (e.g. me), I can ensure the required IE proxy configuration by programmatically setting the following values in the "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"