Powershellを使用してディスクドライブ情報を取得する方法

Powershellを使用してディスクドライブ情報を取得する方法

Get-Diskインストールできませんか?Linux

PS /home/thufir/powershell> 
PS /home/thufir/powershell> Get-Module -ListAvailable


    Directory: /home/thufir/.local/share/powershell/Modules

ModuleType Version    Name                                PSEdition ExportedCommands
---------- -------    ----                                --------- ----------------
Script     0.0.7      PSTwitterAPI                        Desk      {Get-TwitterGeo_Id_PlaceId, Send-TwitterOauth_AccessToken, Send…
Script     2.1.3      SSHSessions                         Desk      {New-SshSession, Invoke-SshCommand, Enter-SshSession, Remove-Ss…

    Directory: /snap/powershell/77/opt/powershell/Modules

ModuleType Version    Name                                PSEdition ExportedCommands
---------- -------    ----                                --------- ------------Manifest   1.2.3.0    Microsoft.PowerShell.Archive        Desk      {Compress-Archive, Expand-Archive}
Manifest   6.1.0.0    Microsoft.PowerShell.Host           Core      {Start-Transcript, Stop-Transcript}
Manifest   6.1.0.0    Microsoft.PowerShell.Management     Core      {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path…}
Manifest   6.1.0.0    Microsoft.PowerShell.Security       Core      {Get-Credential, Get-ExecutionPolicy, Set-ExecutionPolicy, Conv…
Manifest   6.1.0.0    Microsoft.PowerShell.Utility        Core      {Export-Alias, Get-Alias, Import-Alias, New-Alias…}
Script     1.3.2      PackageManagement                   Desk      {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSou…
Script     2.1.3      PowerShellGet                       Desk      {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapabili…
Script     0.0        PSDesiredStateConfiguration         Desk      {Set-NodeResourceSource, Set-NodeResources, Node, Update-Depend…
Script     2.0.0      PSReadLine                          Desk      {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSR…
Binary     1.1.2      ThreadJob                           Desk      Start-ThreadJob

PS /home/thufir/powershell> 
PS /home/thufir/powershell> $PSVersionTable.PSVersion

Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
6      2      3                      

PS /home/thufir/powershell> 

それ〜らしい一度インストールすると、Linuxで動作します。

ベストアンサー1

明らかに、Linuxシステムにはすでにpowershellコアがインストールされています。

コマンドレットが正しく機能するには、Get-DiskストレージPowershellモジュールをインポートする必要があります。

Import-Module -Name Storage

インポート後、モジュールを見ることができます。Get-Module -ListAvailable

ストレージモジュールで使用可能なコマンドレットを表示するには、次のように入力します。Get-Command -Module Storage ディスクと追加のエンクロージャを入手したことがわかります。

ヘルプタイプを更新したことを確認するために、すべてのモジュールとコマンドレットは関連するUpdate-Help -Verboseヘルプファイルを更新します。

おすすめ記事