Hot to get multiple computer services status from user input

Hi, I’m pretty new to PowerShell so please excuse me if my question doesn’t make sense.

We have a large number of pc’s on our network there are hundreds of them. The Pc’s have computer names that are in the following format AJE08860007.
Where the first 4 digits (in this case 0886) identify the site the computers are situated in and the last four digits (0007 in this case) is the computer identification number.

What I need to be able to do is check if 2 services are running on the computers. In an ideal world I would like to use a script file that could do the following…

  1. Ask a user to enter the 4 digit site number i.e. 0886
  2. The script would then continue running and check the status of the 2 services i.e. ServiceName1 and ServiceName2 for all of the computers on the network that have 0886 as their site.
    There could be as many as 12 computers on the network with the same site so I need to display and write the results to a file called Site_nnnn_Results.txt where nnnn would be the site number.

Any help would be really appreciated as I said I’m a real newbee.

Kind Regards
Alan

Alan,
Welcome to the forum. :wave:t4:

That’s usually error prone. A better solution would be to offer a limitted choice for the use to choose from. But anyway that’s easily possible.

That’s possible as well. If you have an AD you can query computers with the same partial name. And as long as you have administrative rights on the target computers you can easily query their services.

What kind of help do you need?

Please keep in mind that this forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request.

What have you tried so far? We expect you to make an own attempt to get your task done or to solve your problem. If you have done so already please document here what exactly you have done and show your code. Then we probably might be able to help you step further.

To get you started you may start reading the following help topics.

Please always read the help for the cmdlets your’e about to use completely including the examples to learn how to use them.