CD Category
Cmdlets are usually implemented around resource operations. The four basic operations are CREATE, READ, UPDATE and DELETE. This set of operations is known as CRUD. Most of the cmdlets support CRUD which are respectively cmdlets that start with the New/Get/Set/Remove cmdlet verbs but they also may have additional operations
Step 1: Retrieve a object by running a Get command
# Connects to a vSphere server and retrieves the CD drive of the virtual machine named VM.
Get-VM -Name VM | Get-CDDrive
Step 2 : Run commands from the CRUD group
# Creates a CD drive on the specified virtual machine and attach an ISO image to it.
New-CDDrive -VM $vm -ISOPath "Path_to_ISO\test.iso"
# Creates a CD drive on the VM virtual machine and attaches testISO.iso, previously uploaded. Then disconnects the ISO.
$cd = New-CDDrive -VM VM -ISOPath "[sof-20666-esx:storage1] ISO\testISO.iso" Set-CDDrive -CD $cd -NoMedia
# Removes all CD drives for the specified virtual machines and templates.
$cd = Get-CDDrive -VM $vm Remove-CDDrive -CD $cd