C#. How to programmatically grant User Log On as a Service - c#

I've searched through the internet, but haven't found any solution in c#. Does anybody know how to give user right to log on as a Service in c#?

EDIT: I found an article on CodeProject with sample code that shows exactly how to do this!
I assume you've already found this KB that shows how to do it with native code. I'm looking for a C# way as well.

I tried in vain to find this. The way I did it in the end was to package the NTRights executable with my application and then launch it as a separate process.
NTRights can be found on the server 2003 resource kti and its usage is documented here:
http://support.microsoft.com/kb/315276

Related

Determine who has a file open using C# - is there a way now?

I need to be able to check who has a file open using C#. I found a few people asked this question before but they were all a long time ago with the latest being in 2012. I was wondering if, in the last 5 years, has Microsoft added this ability to .net or maybe someone came out with a nuget package that is capable.
Here is the latest answer I found
You can use windows internal function NTQuerySystemInformation with undocumented parameter SystemHandleInformation for it. I don't know about c# implementation, but I know delphy code for it, and vb6 code. Check this links, it will help you to make your c# implementation.
Delphi - get what files are opened by an application
https://forum.sysinternals.com/topic14546.html
As far as I know, the standard library still does not have suitable functions for this. There is a popular question about this: https://stackoverflow.com/a/937558/5665527.
Also, if you want to know who opened the file remotely - net file function may be useful (which is accessible via cmd). I believe that there are similar WinAPI functions on MSDN that could be implemented in a similar way.

How to run code against the Quartz.NET server?

I'm new to Quartz.NET and have a simple question. I downloaded the Quartz.NET-2.2 server on my machine. There isn't much documentation on how to use it. I started the server by clicking on Quartz.Server.exe and would like to run Example 1 (HelloJob.cs and SimpleExample.cs) against it. How do I do that? Thanks for your help.
I found this document, http://jayvilalta.com/quartznetbook/QuartzNetQuickstart.pdf. It's a lifesaver. The document answers most of my questions and also provides examples that can be run with the server. Hope this will help others who are looking for the same kind of information.

Targeting a specific Chrome process?

When I open the Chrome's Task Manager, I can see something like this?
Now, programatically, is it somehow possible to target the Chrome instance that is being used to run the Flash Plug-In? Maybe using System.Diagnostics.Process class or native API calls?
I was able to do this with native api calls. My solution worked perfectly on my machine. Here is what I did:
First, get Microsoft Process Explorer. Using this tool, I was able to get the flash plugin dll's name that chrome uses which is called pepflashplayer.dll in my case.
Next, a little search on Bing got me this article. It's C code so I converted to C# and after some coding I was able to retrieve the correct Chrome process ID that uses flash plug-in.
I have uploaded my solution to SkyDrive for you to check here. Note that I am not closing any handles in my sample so you'll have to add that for a real project.
There might be better solutions out there but this one should work. Hope it helps.

Autoupdating software using intranet

i searched for the topic but didn't find exactly that kind of problem.
I want to create a C# WinForms software which should run only in intranet. If i change the software afterwards i would like to have the application to look automatically in the network for a newer version. Is a newer version available it should replace the old one. Maybe there is some tool or library to achieve that?
Further Information: The software does not use a database and consists only out of one .exe file. No other stuff or files needed.
I don't want to setup a server or something like that for this task. I want it as simple and clean as possible.
Thanks in advance.
Joe
I think clickonce may help you. see http://msdn.microsoft.com/en-us/library/t71a733d(v=vs.80).aspx for more details
I really like the updateSystem.NET-lib, but which is only available in german. If you can understand the easy API, this is exactly what you are searching for.
Here, you can find a little tutorial, also in german.

Automate Photoshop with C#

Looking for a way to add a background layer to existing photoshop files with c# code?
Any ideas?
Thanks
-c
Photoshop has a COM interface and here is a document on how to access it via C#.
The specifics of what you want to do will require a bit more digging into Photoshops actual documentation, but this will get you started.
For greater details, check out Adobes scripting guide and SDK information.
You should not have a problem today if you still searching a way to automate Photoshop:
https://helpx.adobe.com/photoshop/using/creating-actions.html

Categories