By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,234 Members | 1,908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,234 IT Pros & Developers. It's quick & easy.

Coding Services

P: n/a
Hi !

I wan't to code a service which will be installed on some clients in our
network.
The service should have the following features :

- Scan all properties of the Client (Hardware, Software etc)
- Create a log (eg. logfile.txt)
- Optional : Insert the data directly in an SQL-Database
- All these functions should occur, when a Timer elapsed or when I send a
command to do this.

My problem : Up to the manual command all functions have been implemented.
So, my question is : How can i communicate with these services to do things
when i want them to do ?
For better understanding : The service has started succesfully and is now
waiting for commands like "Start Scan"

Thanks !!!!!

Christoph
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
H Ghrisoph,

In my opinion is all you ask as samples in the resource kit

Using WMI
The service sample has a part for updating the logfile
Data Entry sample shows how to update the database.
And there are more timer samples.

See the links bellow

I hope this helps?

Cor

VB.net Resource kit
http://msdn.microsoft.com/vbasic/vbrkit/default.aspx

And if you have problems installing the resource kit
http://msdn.microsoft.com/vbasic/vbr...q/#installvdir

Another resource for learning is the Quick Starts
http://samples.gotdotnet.com/quickstart/
I hope this helps a little bit?

Cor

Hi !

I wan't to code a service which will be installed on some clients in our
network.
The service should have the following features :

- Scan all properties of the Client (Hardware, Software etc)
- Create a log (eg. logfile.txt)
- Optional : Insert the data directly in an SQL-Database
- All these functions should occur, when a Timer elapsed or when I send a
command to do this.

My problem : Up to the manual command all functions have been implemented. So, my question is : How can i communicate with these services to do things when i want them to do ?
For better understanding : The service has started succesfully and is now
waiting for commands like "Start Scan"

Thanks !!!!!

Christoph

Nov 20 '05 #2

P: n/a
Hi Cor !

thanks for answering my question.
But my only problem is to "trigger" my service to start the scan.
All other functions are already implemented.

Christoph
Nov 20 '05 #3

P: n/a
Hi Chrisoph,

I thought that that was as well in the service sample from the resource kit,
however from that one I am not completly sure.

Cor

thanks for answering my question.
But my only problem is to "trigger" my service to start the scan.
All other functions are already implemented.

Christoph

Nov 20 '05 #4

P: n/a
Christoph,
The easiest way to have a service accept a "command" to do something is to
override the ServiceBase.OnCustomCommand method and have it call the same
procedure your Timer.Elapsed event handler calls.

Then you can use ServiceController.ExecuteCommand to invoke this custom
command.

Note I would probably define an Enum of CustomCommands that my service
supported so its easier to keep track of them. A custom command for
OnCustomCommand is an integer between 128 & 256, which also means you can
have multiple custom commands defined.

Remember that ServiceController can control services on your local machine
as well as services on remote machines. Note you may need to configure the
various machines to allow remote control of services.

An alternative, more flexible method, which also entails more work, is to
enable your service for .NET Remoting. You could either make it a .NET
Remoting Server, in which case you call a method to have it perform some
action, or a .NET Remoting Client, and possible handle an "update data
event" on your server remoting object that says to update data...

Both of the custom commands & remoting with a service are discussed in
Matthew MacDonalds book "Microsoft Visual Basic .NET Programmer's Cookbook"
from MS Press.

Hope this helps
Jay
"Christoph Duesmann" <c.********@web.de> wrote in message
news:O4**************@TK2MSFTNGP12.phx.gbl...
Hi !

I wan't to code a service which will be installed on some clients in our
network.
The service should have the following features :

- Scan all properties of the Client (Hardware, Software etc)
- Create a log (eg. logfile.txt)
- Optional : Insert the data directly in an SQL-Database
- All these functions should occur, when a Timer elapsed or when I send a
command to do this.

My problem : Up to the manual command all functions have been implemented. So, my question is : How can i communicate with these services to do things when i want them to do ?
For better understanding : The service has started succesfully and is now
waiting for commands like "Start Scan"

Thanks !!!!!

Christoph

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.