【发布时间】:2013-02-12 18:10:31
【问题描述】:
使用 Get-Disk cmdlet 时出现错误
Windows 版本:Microsoft Windows Server 2008 R2 SP1 64b
Windows 2008 R2 powershell 术语“Get-Disk”未被识别为 cmdlet 的名称。我有第 3 版的 Powershell
PS C:\Windows\system32> 获取磁盘
Get-Disk : The term 'Get-Disk' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1
+ Get-Disk
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-Disk:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Windows\system32> $PSVersionTable`
Name Value
---- -----
WSManStackVersion 3.0
PSCompatibleVersions {1.0, 2.0, 3.0}
SerializationVersion 1.1.0.1
BuildVersion 6.2.9200.16398
PSVersion 3.0
CLRVersion 4.0.30319.1
PSRemotingProtocolVersion 2.2
【问题讨论】:
-
这很奇怪。当你运行
Get-Command -Module Storage时,你有什么收获吗?如果没有,请尝试Import-Module Storage,然后再尝试第一个。只是为了确定您是否缺少模块或自动加载不起作用 -
module-storage 仅适用于 windows 2012 不是吗?
-
我不确定它是否仅在 2012 年可用。本来希望在 2008 R2 上使用它。我将 powershell 升级到 3.0,但它仍然无法正常工作。所以假设它仅在 2012(或 Windows 8)及更高版本上受支持。
-
kayasax 似乎是正确的:blogs.technet.com/b/heyscriptingguy/archive/2012/10/26/…good catch =)
-
还尝试了 2 个命令,但“Get-Command -Module Storage”没有响应,而另一个我收到错误消息。 Import-Module : 未加载指定的模块“Storage”,因为在任何模块目录中都找不到有效的模块文件。
标签: windows powershell