Windows 2008 R2 powershell术语"Get-Disk"无法识别为cmdlet的名称

Sah*_*ala 5 windows powershell

使用Get-Disk cmdlet时出错

Windows版本:Microsoft Windows Server 2008 R2 SP1 64b

Windows 2008 R2 powershell术语"Get-Disk"无法识别为cmdlet的名称.我有Powershell的第3版

PS C:\ Windows\system32> Get-Disk

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  
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

Pau*_*and 6

[只是将评论结合到答案中并添加了一点]

我还希望Get-Disk在Azure VM Server 2008 R2上使用该命令,我安装了PowerShell 3.0 Get-Disk但仍然无法使用,然后用Google搜索到此页面.

从这篇Scripting Guy博客链接中可以看出这一点

注意Windows PowerShell 3.0 for Windows 7的版本目前不包含存储模块,因此需要Windows 8或Windows Server 2012.

因此,如果您希望Get-Disk在Windows Server 2008 R2上使用,则无法进行.

相同的Scripting Guy链接还提供了可以使用的相关DiskPart命令.

From an elevated shell:

    DiskPart.exe
    List disk
    Select disk 1—disk 1 being the USB drive
    Clean
    Create partition primary
    Select partition 1—partition 1 being the new partition
    Active
    Format FS=NTFS
Run Code Online (Sandbox Code Playgroud)