Windows 2008 R2 powershell window The term "Get-Disk" is not recognized as a cmdlet name

I get an error when using the Get-Disk cmdlet

Windows Version: Microsoft Windows Server 2008 R2 SP1 64b

Windows PowerShell Windows 2008 R2 The term "Get-Disk" is not recognized as the name of the cmdlet. I have Powershell version 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 

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 
+4
source share
2 answers

[A simple combination of comments in response and adding a little]

I also tried using the Get-Disk command on Azure VM Server 2008 R2, I installed PowerShell 3.0 and Get-Disk , which is still unavailable, and then went to this page.

From this link on the Scripting Guy Blog , it’s mentioned that

Note. Windows PowerShell version 3.0 for Windows 7 does not support. At this point, the storage module must be installed, so Windows 8 or Windows Server 2012 is required.

So, if you want to use Get-Disk in Windows Server 2008 R2, you cannot.

The same Scripting Guy link also contains the appropriate 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 
+6
source

Depending on your use case, note that you can also get information on disk in a command shell without using a cmdlet using the Win32_Volume class. For example, you can do the following to change the drive letter:

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

All Articles