Document Unix platform support for Get/Start/Stop/Restart-Service

Ouverte Adaptée aux débutants
#13,385 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@soroshsabz y travaille déjà.

Depuis le 10/11/2026.

  • #13383 par @soroshsabz — ouverte

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
85/100
Type d'issue
Documentation
Clarté
Clairement spécifiée
Activité
Active
Stack technique
powershell
Domaine
documentation

Piste de recherche

Mettez à jour les quatre articles de cmdlets nommés sous reference/7.7/Microsoft.PowerShell.Management : Get-Service.md, Start-Service.md, Stop-Service.md et Restart-Service.md. Commencez par lire leurs sections DESCRIPTION, PARAMETERS, OUTPUTS et NOTES en parallèle du contenu suggéré dans cet issue. Le travail est terminé lorsque les articles décrivent la détection des gestionnaires de services Unix, la sortie de UnixServiceController, les exigences liées à sudo et le comportement des paramètres propre à chaque plateforme, et suppriment les indications de disponibilité réservée à Windows.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Prerequisites
  • Existing Issue: Search the existing issues for this repository. If there is an issue that fits your needs do not file a new one. Subscribe, react, or comment on that issue instead.
  • Descriptive Title: Write the title for this issue as a short synopsis. If possible, provide context. For example, "Document new Get-Foo cmdlet" instead of "New cmdlet."
Summary

PowerShell is adding Unix platform support for the Get-Service, Start-Service, Stop-Service, and Restart-Service cmdlets in PowerShell 7.7. The cmdlet references currently document these cmdlets as Windows-only; they need to describe the new Unix behavior, the returned UnixServiceController object, and the sudo requirements for service management.

Details

The change was proposed in PowerShell/PowerShell#18863 and is implemented in PowerShell/PowerShell#28385: on Linux and macOS, the four service cmdlets work through the system service manager, which is discovered in this order: systemctl (systemd), launchctl (macOS), service (sysvinit), and rc-service (OpenRC).

On Unix platforms:

  • The cmdlets return UnixServiceController objects instead of System.ServiceProcess.ServiceController objects. The Status and StartType properties map the service manager state onto the same enumerations that are used on Windows.
  • Getting service information doesn't require elevated permissions. The service management cmdlets require root privileges; when they aren't running as root, they wrap the service manager command with sudo -n and write a non-terminating error when elevation isn't available.
  • The DependentServices and RequiredServices parameters are only populated by systemd.
  • The Force parameter is accepted for script compatibility but has no effect on Unix.
  • The remaining service cmdlets (Set-Service, New-Service, Remove-Service, Suspend-Service, and Resume-Service) stay Windows-only.
Articles
  • Get-Service (reference/7.7/Microsoft.PowerShell.Management/Get-Service.md)
  • Start-Service (reference/7.7/Microsoft.PowerShell.Management/Start-Service.md)
  • Stop-Service (reference/7.7/Microsoft.PowerShell.Management/Stop-Service.md)
  • Restart-Service (reference/7.7/Microsoft.PowerShell.Management/Restart-Service.md)

Suggested updates:

  1. Remove the "This cmdlet is only available on the Windows platform." callouts and the Windows-only availability notes.
  2. Document the Unix service manager discovery order, the UnixServiceController output object, the sudo requirements, and the per-parameter platform behavior in the DESCRIPTION, PARAMETERS, OUTPUTS, and NOTES sections.
Suggested content

Unix support note for each cmdlet's DESCRIPTION section:

Beginning in PowerShell 7.7, this cmdlet is also available on Linux and macOS. On Unix platforms the cmdlet works through the system service manager, which it discovers in this order: systemctl (systemd), launchctl (macOS), service (sysvinit), and rc-service (OpenRC). For more information, see the Notes section.

Unix output object section:

Microsoft.PowerShell.Commands.UnixServiceController

On Unix platforms, this cmdlet returns UnixServiceController objects that represent the services reported by the system service manager.

Related Source Pull Requests
Related Source Issues
Langage dominant
PowerShell
Étoiles
2.6k
Forks
1.7k
Merge moyen
1 j 4 h
PR mergées (30 j)
4

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de MicrosoftDocs/PowerShell-Docs

Toutes les issues de MicrosoftDocs/PowerShell-Docs

Issues similaires

Plus d'issues Documentation

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.