powershellscripts.com

Tutorials  PowerShell Cmdlet Help for Get-HardDisk



NAME
Get-HardDisk

SYNOPSIS
Retrieves the virtual hard disks available on a vSphere server.

SYNTAX
Get-HardDisk [-Path ] [-DiskType ] [-Id ] [-Server ] [ ameters>]

Get-HardDisk -Datastore [-DatastorePath ] [-DiskType ] [-Id ] [-Serve
r ] []

Get-HardDisk [-DiskType ] [[-VM] ] [[-Template] ] [[-Snapshot] ]>] [-Id ] [-Name ] [-Server ] []


DESCRIPTION
Returns the virtual hard disks available on a vSphere server. You can retrieve a hard disk by specifying the virtua
l machines, templates, or snapshots to which it belongs. If the hard disk is attached to no virtual machines, templ
ates, or snapshots, you can search for it in datastores or retrieve it by providing a datastore path to the file wh
ere the virtual hard disk is stored. In this case, you might not be able to derive disk type info, and the value of
the DiskType property of the hard disk is Unknown.


PARAMETERS
-Path
Specify the file paths to the virtual hard disks you want to retrieve. The cmdlet searches recursively the spec
ified locations.

Required? false
Position? named
Default value If in a datastore provider - the current path, else - null.
Accept pipeline input? false
Accept wildcard characters? true

-DiskType
Specify the type of the hard disks you want to retrieve. The valid values are rawVirtual, rawPhysical, flat, an
d unknown. If the hard disk is attached to no virtual machines, templates, or snapshots, you can retrieve it by
providing a datastore path to the file where the virtual hard disk is stored. In this case, you might not be a
ble to derive disk type info, and the value of the DiskType property of the hard disk is Unknown.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Id
Specify the Ids of the hard disks you want to retrieve.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? true

-Server
Specify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the co
mmand runs on the default servers. For more information about default servers, see the description of Connect-V
IServer.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? true

-Datastore
Specify the datastores you want to search for hard disks. This parameter is required when retrieving a hard dis
k that is attached to no virtual machines, templates, or snapshots.

Required? false
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-DatastorePath
Specify datastore paths to the hard disks you want to retrieve. The paths must be in the following format: [dat
astore_name] , where [datastore_name] is the name of the datastore in square brackets and > is a slash-delimited path from the root of the datastore to the virtual hard disk file.
The cmdlet searches recursively the specified locations.

To learn more about the Datastore Provider, in the vSphere PowerCLI service console,type:

help about_vimdatastore

Required? false
Position? named
Default value If working in the datastore provider - the current path, else - &null.
Accept pipeline input? false
Accept wildcard characters? true

-VM
Specify the virtual machines from which you want to retrieve the hard disks.

Required? false
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-Template
Specify the virtual machine templates from which you want to retrieve the hard disks.

Required? false
Position? 2
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-Snapshot
Specify the snapshots from which you want to retrieve the hard disks.

Required? false
Position? 3
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false

-Name
Specify the names of the SCSI hard disks you want to retrieve.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? true


This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

INPUTS



OUTPUTS
HardDisk


NOTES




-------------- Example 1 --------------

C:\PS>Get-HardDisk -VM VM


Retrieves the hard disks of the virtual machine named VM.





-------------- Example 2 --------------

C:\PS>Get-HardDisk -VM $vm -DiskType flat


Retrieves the flat hard disks from the specified virtual machines.





-------------- Example 3 --------------

C:\PS>Get-HardDisk -Datastore "Storage1" -DatastorePath "[Storage1] myVM/"


Retrieves the hard disks from the specified datastore and from the specified datastore path.






RELATED LINKS
Online version: http://www.vmware.com/support/developer/PowerCLI/PowerCLI501/html/Get-HardDisk.html
Copy-HardDisk
New-HardDisk
Remove-HardDisk
Set-HardDisk