Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Windows version: Microsoft Windows Server 2008 R2 SP1 64b

Windows 2008 R2 powershell The term 'Get-Disk' is not recognized as the name of a cmdlet. I have version 3 of Powershell

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`

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
like image 479
Sahen Gala Avatar asked Feb 12 '13 18:02

Sahen Gala


Video Answer


1 Answers

[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.

From this Scripting Guy blog link it mentions that

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.

So if your looking to use Get-Disk on Windows Server 2008 R2, you cant.

The same Scripting Guy link also provides the relevant DiskPart commands that can be used instead.

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
like image 172
Paul Rowland Avatar answered Oct 03 '22 09:10

Paul Rowland