# Hot to get multiple computer services status from user input

**URL:** <https://forums.powershell.org/t/hot-to-get-multiple-computer-services-status-from-user-input/19045>\
**Category:** PowerShell Help\
**Created:** [April 8, 2022, 11:59am UTC](https://forums.powershell.org/t/hot-to-get-multiple-computer-services-status-from-user-input/19045 "2022-04-08T11:59:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cardscale](https://avatars.discourse-cdn.com/v4/letter/c/bcef8e/32.png) [@Cardscale](https://forums.powershell.org/u/Cardscale)\
**Post date:** [April 8, 2022, 11:59am UTC](https://forums.powershell.org/t/hot-to-get-multiple-computer-services-status-from-user-input/19045/1 "2022-04-08T11:59:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [April 8, 2022, 1:17pm UTC](https://forums.powershell.org/t/hot-to-get-multiple-computer-services-status-from-user-input/19045/2 "2022-04-08T13:17:45Z")

</div>

Alan,  
Welcome to the forum. 👋🏽

> [@Cardscale](#):
>
> Ask a user to enter the 4 digit site number i.e. 0886

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.

> [@Cardscale](#):
>
> 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

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.

> **[Get-ADComputer (ActiveDirectory)](https://learn.microsoft.com/en-us/powershell/module/activedirectory/get-adcomputer?view=windowsserver2022-ps)**
>
> Use this topic to help manage Windows and Windows Server technologies with Windows PowerShell.

> **[Get-Service (Microsoft.PowerShell.Management) - PowerShell](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-service?view=powershell-5.1)**
>
> The Get-Service cmdlet gets objects that represent the services on a local computer or on a remote computer, including running and stopped services. By default, when Get-Service is run without parameters, all the local computer's services are...

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

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:18pm UTC](https://forums.powershell.org/t/hot-to-get-multiple-computer-services-status-from-user-input/19045/3 "2024-05-16T20:18:04Z")

</div>

Closed on May 16, 2024, 8:18pm UTC


