I have seen some page hits to my blog where people are searching for "power shell code for ejecting CD drive" and landing at my post which describes the procedure using VBscript. So, posting the powershell equivalent code here for such peoples reference.
The above code ejects a CD drive. If you have want to close the CD drive repeat the second statement again. If you have multiple CD drives, you need to play with array object in second line to eject/close a specific CD drive.
Happy Learning..,
Sitaram Pamarthi
1. $mycds = (New-Object -com "WMPlayer.OCX.7").cdromCollection 2. $mycds.item (0).eject()
The above code ejects a CD drive. If you have want to close the CD drive repeat the second statement again. If you have multiple CD drives, you need to play with array object in second line to eject/close a specific CD drive.
Happy Learning..,
Sitaram Pamarthi
No comments:
Post a Comment