简体   繁体   English

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

[英]Windows 2008 R2 powershell The term 'Get-Disk' is not recognized as the name of a cmdlet

I am getting an error when using Get-Disk cmdlet 使用Get-Disk cmdlet时出错

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

Windows 2008 R2 powershell The term 'Get-Disk' is not recognized as the name of a cmdlet. Windows 2008 R2 powershell术语“Get-Disk”无法识别为cmdlet的名称。 I have version 3 of Powershell 我有Powershell的第3版

PS C:\\Windows\\system32> Get-Disk 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  

PS C:\\Windows\\system32> $PSVersionTable` 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

[Just combining the comments into an answer and added a bit] [只是将评论结合到答案中并添加了一点]

I also was looking to use the Get-Disk command on an Azure VM Server 2008 R2, I installed PowerShell 3.0 and Get-Disk was still not available, and then googled to this page. 我还希望在Azure VM Server 2008 R2上使用Get-Disk命令,我安装的PowerShell 3.0和Get-Disk仍然不可用,然后用Google搜索到此页面。

From this Scripting Guy blog link it mentions that 从这篇Scripting Guy博客链接中可以看出这一点

Note The version of Windows PowerShell 3.0 for Windows 7 does not contain the Storage module at this time, so Windows 8 or Windows Server 2012 is a requirement. 注意Windows PowerShell 3.0 for Windows 7的版本目前不包含存储模块,因此需要Windows 8或Windows Server 2012。

So if your looking to use Get-Disk on Windows Server 2008 R2, you cant. 因此,如果您希望在Windows Server 2008 R2上使用Get-Disk ,那么您无法做到。

The same Scripting Guy link also provides the relevant DiskPart commands that can be used instead. 相同的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

Depending on your use case, note that you can also get information on the disk in powershell without using a cmdlet, using the Win32_Volume class For example, you could do the following to change the drive letter: 根据您的使用情况,请注意您还可以使用Win32_Volume类在不使用cmdlet的情况下获取PowerShell中的磁盘信息。例如,您可以执行以下操作来更改驱动器号:

$drive = gwmi win32_volume -Filter "DriveLetter = 'F:'"
$drive.DriveLetter = "D:"
$drive.Put()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Powershell Windows Server 2008 R2 SP1中未将术语“ Get-MsmqQueue”识别为cmdlet的名称 - Powershell The term 'Get-MsmqQueue' is not recognized as the name of a cmdlet in Windows Server 2008 R2 SP1 Python、Windows:术语“conda”未被识别为 cmdlet 的名称 - Python, Windows: The term 'conda' is not recognized as the name of a cmdlet pyenv windows 术语“pyenv”未被识别为 cmdlet 的名称,function - pyenv windows the term 'pyenv' is not recognized as the name of a cmdlet, function 术语“cmake”未被识别为 cmdlet 的名称 - The term 'cmake' is not recognized as the name of a cmdlet Windows Azure VM Server 2008 R2-缺少磁盘空间 - Windows Azure VM Server 2008 R2 - missing disk space Powershell - 管道获取磁盘变量时出现 InputObject 错误消息 - Powershell - InputObject error message when piping a get-disk variable 术语“gulp”未被识别为cmdlet错误的名称 - The term 'gulp' is not recognized as the name of a cmdlet error VSCode 终端:术语“节点”未被识别为 cmdlet 的名称 - VSCode Terminal: The term 'node' is not recognized as the name of a cmdlet 如何设置 Windows shell 环境变量? 术语“C:\Users\stojko\”未被识别为 cmdlet 的名称 - How to set Windows shell env variable? The term 'C:\Users\stojko\' is not recognized as the name of a cmdlet 在 Windows Server 2008 R2 上的 PowerShell 中创建专用队列 - Creating private queues in PowerShell on Windows Server 2008 R2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM