Powershell Resize-VHD wird nicht als Name eines Cmdlets erkannt

1938
Codeguard

Ich versuche, ein Resize-VHDCmdlet zu verwenden, aber dies führt zu dem folgenden Fehler:

PS> Resize-VHD -Path "C:\Container.vhd" -SizeBytes 20GB Error: Resize-VHD : The term 'Resize-VHD' 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 + Resize-VHD -Path "C:\Container.vhd" -SizeBytes 20GB + ~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Resize-VHD:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException 

Wie kann ich das beheben?

5

1 Antwort auf die Frage

5
Codeguard

Es stellte sich heraus, dass ich Hyper-V-Funktionen unter Windows installieren musste (obwohl ich Hyper-V selbst nicht benötige, verwende ich VHD als portablen Dateicontainer).

  1. Gehe zu Control Panel | Programs and features | Turn windows features on or off
  2. Tick Hyper-V | Hyper-V Management tools | Hyper-V Module for Windows PowerShell
  3. Starten Sie nach der Installation neu, wenn Sie dazu aufgefordert werden
Nun, ich musste die Hyper-V-Plattform installieren Teil von Hyper-V Services. (Das erfordert einen Neustart.) `Resize-VHD` funktionierte erst danach. Hinweis: Ich war besorgt (wie ich solche Streiche von MS und anderen gesehen habe ...), aber "Hyper-V Services" erfordert zum Glück keine Hyper-V-fähige Hardware. Sz. vor 5 Jahren 0