PowerShell fonctionne-t-il sur d'autres systèmes d'exploitation que Windows?

Table des matières:

PowerShell fonctionne-t-il sur d'autres systèmes d'exploitation que Windows?
PowerShell fonctionne-t-il sur d'autres systèmes d'exploitation que Windows?

Vidéo: PowerShell fonctionne-t-il sur d'autres systèmes d'exploitation que Windows?

Vidéo: PowerShell fonctionne-t-il sur d'autres systèmes d'exploitation que Windows?
Vidéo: Réparer l'écran bleu sur Windows 11/10 rapidement !! | 4DDiG Windows Boot Genius - YouTube 2024, Avril
Anonim
Cela peut être très frustrant lorsque votre professeur dit une chose à propos de PowerShell et que divers sites Web semblent offrir une preuve irréfutable. PowerShell fonctionne-t-il ou non sur des systèmes autres que Windows? L’article d’aujourd’hui sur le SuperUser Q & R répond aux questions d’un lecteur perplexe.
Cela peut être très frustrant lorsque votre professeur dit une chose à propos de PowerShell et que divers sites Web semblent offrir une preuve irréfutable. PowerShell fonctionne-t-il ou non sur des systèmes autres que Windows? L’article d’aujourd’hui sur le SuperUser Q & R répond aux questions d’un lecteur perplexe.

La séance de questions et réponses d’aujourd’hui nous est offerte par SuperUser, une sous-division de Stack Exchange, un groupe de sites Web de questions-réponses dirigé par la communauté.

La question

Le lecteur superutilisateur FredSavage187 veut savoir si PowerShell fonctionne sur d'autres systèmes d'exploitation que Windows:

My computer science professor recently gave us a quiz and one of the questions was, “True or False: PowerShell works on Windows, Mac, and Linux”. The correct answer was “false” and he maintains that PowerShell is a Windows only thing. But I found a couple of websites that say otherwise:

PowerShell is open sourced and is available on Linux [Microsoft Azure Blog]

PowerShell Repository [GitHub]

Which one is actually correct? Does PowerShell work on Linux and Mac OS as well as Windows?

PowerShell fonctionne-t-il sur d'autres systèmes d'exploitation que Windows?

La réponse

Le contributeur SuperUser Ben N a la réponse pour nous:

Yes. Much of PowerShell is.NET, so it can run on any operating system that has the Common Language Runtime (CLR). On Windows, that is the.NET Framework. For other operating systems, including Linux, you can use the CoreCLR, an open-source, cross-platform subset of the.NET Framework.

As you learned at the PowerShell repository on GitHub, quite a few operating systems and distributions are supported. For example, here are the instructions for Ubuntu and a demonstration:

Image
Image

One could argue that not all of PowerShell is available in non-Windows environments since some features depend on libraries found only in Windows. The ParsedHtml property on the HtmlWebResponseObject type returned by Invoke-WebRequest, for example, is only useful on Windows because it holds a COM object that comes from an unmanaged library, mshtml.dll to be specific. On other platforms, there is nothing there. And, of course, there are cmdlets to manage systems found only in Windows, like Modern apps (Get-AppxPackage, for example).

Still though, the PowerShell infrastructure works perfectly well on other operating systems, plenty of the cmdlets are usable anywhere, and support is only getting better.

Avez-vous quelque chose à ajouter à l'explication? Sound off dans les commentaires. Voulez-vous lire plus de réponses d'autres utilisateurs de Stack Exchange doués en technologie? Découvrez le fil de discussion complet ici.

Crédits image: Jeff Hicks (base de connaissances Petri IT)

Conseillé: