PowerShell Come montare un disco rigido virtuale (VHD)

Se si desidera accedere ai contenuti di un file VHD senza dover eseguire Virtual PC o Virtual Server, è possibile farlo utilizzando PowerShell ed eseguendo un paio di comandi dalla riga di comando.

1. Aprire PowerShell.

2. Inserisci ed esegui il seguente comando:

$ objVHDService = get-wmiobject -class "Msvm_ImageManagementService" -namespace "root \ virtualization" -computername "."

Per montare un file VHD:

Inserisci ed esegui il seguente comando:

$ ObjVHDService.Mount ( "e: \ virtuale \ test \ test.vhd")

Dove e: \ virtual \ test \ test.vhd è il percorso del disco rigido virtuale desiderato.

Smontare un file VHD:

Inserisci ed esegui il seguente comando:

$ ObjVHDService.Unmount ( "e: \ virtuale \ test \ test.vhd")

Dove e: \ virtual \ test \ test.vhd è il percorso del disco rigido virtuale desiderato.