469,590 Members | 2,497 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,590 developers. It's quick & easy.

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 1817
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Glenn Venzke | last post: by
5 posts views Thread by Andrew | last post: by
3 posts views Thread by Saran | last post: by
27 posts views Thread by pisquem | last post: by
9 posts views Thread by Yasir Zaheer | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.