473,385 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Setting a Windows Service to interact with the desk top and also log on as a user account

Hello everyone

I have written a Windows Service to monitor local and remote
Processes/Applications. However I am stuck because if it is installed as a
user account I cannot get it to interact with the desktop and therefore get
the System.Diagnostics.Process.Responding of an app. But if I set it as a
System account that interacts with the desktop I have all sorts of security
issues.

I frigged the Type field within the Services registry entry which now shows
that it can interact with the desktop but it still refuses to play. Anyone
else come up against anything like this?

Cheers

--
Ian Frawley
Nov 15 '05 #1
6 1926
Ian,

I would not ever have a service that interacts with a desktop. It just
doesn't make sense. The reason for this is that there might not always be a
user logged in, but the service will always be running.

What you should do is have an application that communicates with the
service (using some mechanism, remoting, pipes, etc, etc). This will allow
you to run the service under any account you like, and allow it to interact
with the desktop (through a layer of indirection).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ian Frawley" <ch****@away.com> wrote in message
news:ub**************@TK2MSFTNGP12.phx.gbl...
Hello everyone

I have written a Windows Service to monitor local and remote
Processes/Applications. However I am stuck because if it is installed as a
user account I cannot get it to interact with the desktop and therefore get the System.Diagnostics.Process.Responding of an app. But if I set it as a
System account that interacts with the desktop I have all sorts of security issues.

I frigged the Type field within the Services registry entry which now shows that it can interact with the desktop but it still refuses to play. Anyone
else come up against anything like this?

Cheers

--
Ian Frawley

Nov 15 '05 #2
Hi Nicholas,

Yeah I see what you mean. However the majority of the apps being monitored
will be running as processes on remote machines and will definatley be
logged on to the desktop. This means that even if the service is able to
interact with the desktop it probably means that it won't be able to on a
remote machine anyway. Hmmmmmm this seems to have become the fly in the
ointment and bust me design.

Damn

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ew**************@TK2MSFTNGP11.phx.gbl...
Ian,

I would not ever have a service that interacts with a desktop. It just doesn't make sense. The reason for this is that there might not always be a user logged in, but the service will always be running.

What you should do is have an application that communicates with the
service (using some mechanism, remoting, pipes, etc, etc). This will allow you to run the service under any account you like, and allow it to interact with the desktop (through a layer of indirection).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ian Frawley" <ch****@away.com> wrote in message
news:ub**************@TK2MSFTNGP12.phx.gbl...
Hello everyone

I have written a Windows Service to monitor local and remote
Processes/Applications. However I am stuck because if it is installed as a user account I cannot get it to interact with the desktop and therefore

get
the System.Diagnostics.Process.Responding of an app. But if I set it as a System account that interacts with the desktop I have all sorts of

security
issues.

I frigged the Type field within the Services registry entry which now

shows
that it can interact with the desktop but it still refuses to play. Anyone else come up against anything like this?

Cheers

--
Ian Frawley


Nov 15 '05 #3
Ian,

I am surprized that the Process class can not monitor the local
processes if it is not interactive with the desktop. Are you sure this is
the case?

Also, even if you can't interact with the desktop, you should still see
information about remote services (since you can't interact with their
desktops).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ian Frawley" <ch****@away.com> wrote in message
news:uw*************@tk2msftngp13.phx.gbl...
Hi Nicholas,

Yeah I see what you mean. However the majority of the apps being monitored
will be running as processes on remote machines and will definatley be
logged on to the desktop. This means that even if the service is able to
interact with the desktop it probably means that it won't be able to on a
remote machine anyway. Hmmmmmm this seems to have become the fly in the
ointment and bust me design.

Damn

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:ew**************@TK2MSFTNGP11.phx.gbl...
Ian,

I would not ever have a service that interacts with a desktop. It just
doesn't make sense. The reason for this is that there might not always be a
user logged in, but the service will always be running.

What you should do is have an application that communicates with the
service (using some mechanism, remoting, pipes, etc, etc). This will allow
you to run the service under any account you like, and allow it to

interact
with the desktop (through a layer of indirection).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ian Frawley" <ch****@away.com> wrote in message
news:ub**************@TK2MSFTNGP12.phx.gbl...
Hello everyone

I have written a Windows Service to monitor local and remote
Processes/Applications. However I am stuck because if it is installed
as a user account I cannot get it to interact with the desktop and
therefore get
the System.Diagnostics.Process.Responding of an app. But if I set it
as a System account that interacts with the desktop I have all sorts of

security
issues.

I frigged the Type field within the Services registry entry which now

shows
that it can interact with the desktop but it still refuses to play. Anyone else come up against anything like this?

Cheers

--
Ian Frawley



Nov 15 '05 #4
Nick,

I have tested the Process class and it always returns true when running as a
service that doesn't interact with the desktop. I dun know why it just does.
I am going to see if there are any WMI classes that I can use instead.

Cheers

Ian
Ian,

I am surprized that the Process class can not monitor the local
processes if it is not interactive with the desktop. Are you sure this is
the case?

Also, even if you can't interact with the desktop, you should still see information about remote services (since you can't interact with their
desktops).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ian Frawley" <ch****@away.com> wrote in message
news:uw*************@tk2msftngp13.phx.gbl...
Hi Nicholas,

Yeah I see what you mean. However the majority of the apps being monitored
will be running as processes on remote machines and will definatley be
logged on to the desktop. This means that even if the service is able to
interact with the desktop it probably means that it won't be able to on a remote machine anyway. Hmmmmmm this seems to have become the fly in the
ointment and bust me design.

Damn

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ew**************@TK2MSFTNGP11.phx.gbl...
Ian,

I would not ever have a service that interacts with a desktop. It

just
doesn't make sense. The reason for this is that there might not always be
a
user logged in, but the service will always be running.

What you should do is have an application that communicates with
the service (using some mechanism, remoting, pipes, etc, etc). This will

allow
you to run the service under any account you like, and allow it to

interact
with the desktop (through a layer of indirection).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ian Frawley" <ch****@away.com> wrote in message
news:ub**************@TK2MSFTNGP12.phx.gbl...
> Hello everyone
>
> I have written a Windows Service to monitor local and remote
> Processes/Applications. However I am stuck because if it is installed as
a
> user account I cannot get it to interact with the desktop and

therefore get
> the System.Diagnostics.Process.Responding of an app. But if I set it

as
a
> System account that interacts with the desktop I have all sorts of
security
> issues.
>
> I frigged the Type field within the Services registry entry which

now shows
> that it can interact with the desktop but it still refuses to play.

Anyone
> else come up against anything like this?
>
> Cheers
>
> --
> Ian Frawley
>
>



Nov 15 '05 #5
Ian,

You should be able to use the Win32_Process class as an alternative.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ian Frawley" <ch****@away.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Nick,

I have tested the Process class and it always returns true when running as a service that doesn't interact with the desktop. I dun know why it just does. I am going to see if there are any WMI classes that I can use instead.

Cheers

Ian
Ian,

I am surprized that the Process class can not monitor the local
processes if it is not interactive with the desktop. Are you sure this is
the case?

Also, even if you can't interact with the desktop, you should still see
information about remote services (since you can't interact with their
desktops).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ian Frawley" <ch****@away.com> wrote in message
news:uw*************@tk2msftngp13.phx.gbl...
Hi Nicholas,

Yeah I see what you mean. However the majority of the apps being monitored will be running as processes on remote machines and will definatley be
logged on to the desktop. This means that even if the service is able to interact with the desktop it probably means that it won't be able to on a
remote machine anyway. Hmmmmmm this seems to have become the fly in
the ointment and bust me design.

Damn

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ew**************@TK2MSFTNGP11.phx.gbl...
> Ian,
>
> I would not ever have a service that interacts with a desktop.
It just
> doesn't make sense. The reason for this is that there might not

always
be
a
> user logged in, but the service will always be running.
>
> What you should do is have an application that communicates with

the > service (using some mechanism, remoting, pipes, etc, etc). This will allow
> you to run the service under any account you like, and allow it to
interact
> with the desktop (through a layer of indirection).
>
> Hope this helps.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mv*@spam.guard.caspershouse.com
>
> "Ian Frawley" <ch****@away.com> wrote in message
> news:ub**************@TK2MSFTNGP12.phx.gbl...
> > Hello everyone
> >
> > I have written a Windows Service to monitor local and remote
> > Processes/Applications. However I am stuck because if it is installed
as
a
> > user account I cannot get it to interact with the desktop and

therefore
> get
> > the System.Diagnostics.Process.Responding of an app. But if I set it as
a
> > System account that interacts with the desktop I have all sorts of
> security
> > issues.
> >
> > I frigged the Type field within the Services registry entry which

now > shows
> > that it can interact with the desktop but it still refuses to

play. Anyone
> > else come up against anything like this?
> >
> > Cheers
> >
> > --
> > Ian Frawley
> >
> >
>
>



Nov 15 '05 #6
Yeah I have been looking at that as I collect other Process metrics from
that class. I am also looking at using Event Traces.

Cheers

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:OX**************@TK2MSFTNGP09.phx.gbl...
Ian,

You should be able to use the Win32_Process class as an alternative.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ian Frawley" <ch****@away.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Nick,

I have tested the Process class and it always returns true when running as
a
service that doesn't interact with the desktop. I dun know why it just does.
I am going to see if there are any WMI classes that I can use instead.

Cheers

Ian
Ian,

I am surprized that the Process class can not monitor the local
processes if it is not interactive with the desktop. Are you sure this is the case?

Also, even if you can't interact with the desktop, you should
still
see
information about remote services (since you can't interact with their
desktops).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ian Frawley" <ch****@away.com> wrote in message
news:uw*************@tk2msftngp13.phx.gbl...
> Hi Nicholas,
>
> Yeah I see what you mean. However the majority of the apps being monitored
> will be running as processes on remote machines and will definatley
be > logged on to the desktop. This means that even if the service is able to > interact with the desktop it probably means that it won't be able to on
a
> remote machine anyway. Hmmmmmm this seems to have become the fly in
the > ointment and bust me design.
>
> Damn
>
> "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
> message news:ew**************@TK2MSFTNGP11.phx.gbl...
> > Ian,
> >
> > I would not ever have a service that interacts with a desktop. It > just
> > doesn't make sense. The reason for this is that there might not

always
be
> a
> > user logged in, but the service will always be running.
> >
> > What you should do is have an application that communicates
with the
> > service (using some mechanism, remoting, pipes, etc, etc). This will > allow
> > you to run the service under any account you like, and allow it to
> interact
> > with the desktop (through a layer of indirection).
> >
> > Hope this helps.
> >
> >
> > --
> > - Nicholas Paldino [.NET/C# MVP]
> > - mv*@spam.guard.caspershouse.com
> >
> > "Ian Frawley" <ch****@away.com> wrote in message
> > news:ub**************@TK2MSFTNGP12.phx.gbl...
> > > Hello everyone
> > >
> > > I have written a Windows Service to monitor local and remote
> > > Processes/Applications. However I am stuck because if it is

installed
as
> a
> > > user account I cannot get it to interact with the desktop and
therefore
> > get
> > > the System.Diagnostics.Process.Responding of an app. But if I
set it as
> a
> > > System account that interacts with the desktop I have all sorts
of > > security
> > > issues.
> > >
> > > I frigged the Type field within the Services registry entry

which now
> > shows
> > > that it can interact with the desktop but it still refuses to

play. > Anyone
> > > else come up against anything like this?
> > >
> > > Cheers
> > >
> > > --
> > > Ian Frawley
> > >
> > >
> >
> >
>
>



Nov 15 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Glenn Venzke | last post by:
I'd like to write a windows service. Unfortunately, my company would only spring for the standard edition of VB.NET which doesn't support the creation of windows services. Is it possible to write one...
3
by: Michael | last post by:
Hi, I have a windows service developed using c# and it needs to lunch another windows application. I have been trying to use Process class to do it but the problem is becase windows service...
4
by: Primo | last post by:
Hi, This problem has been frustrating me for days and I hope you experts can help me out. I am trying to run a command, which I would normally run from the command line, from within my C#...
6
by: Bijesh | last post by:
Hi All, I've developed a Windows Service that acts as a remoting server (.NET Remoting). The client(user) is able to connect to the server and start a program by giving the executable path of...
5
by: Andrew | last post by:
Hey all, Requesting help from the VB.Net gurus in here. I was given a task to write a Windows Service (VB.Net) that would run an external program, and if that program closed for any reason...
3
by: Saran | last post by:
I have a windows service which instantiates the Powerpoint Application using PIA. When I am running this windows service am not able to open the Microsoft powerpoint application. This problem...
27
by: pisquem | last post by:
I am building an windows service that is to be deployed on a windows server 2003 and I want to have activity written to the event log, I want its own log called ('CustomLog') Below is what I...
3
by: illegal.prime | last post by:
Hi all, I have a service that needs to start a regular windows application. I'm running the service as ServiceAccount.LocalSystem. But, when it starts the process (using Process.Start) the GUI...
9
by: Yasir Zaheer | last post by:
I have made a windows service which is configured to start automatically at the system startup under the USER account type. The service is working perfectly fine when I try to start it manually,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.