是不是无法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 核心。
为了使 cmdlet 正常Get-Disk
工作,您需要导入存储 powershell 模块。
Import-Module -Name Storage
导入后,您将能够看到该模块Get-Module -ListAvailable
要查看存储模块的可用 cmdlet,您可以键入。Get-Command -Module Storage
您将看到您已获得磁盘以及更多存储模块。
为了确保您已更新帮助类型Update-Help -Verbose
,并且所有模块和 cmdlet 都将更新其关联的帮助文件。