Why knowing command line is important for any system administrator

Why knowing command line is important for any system administrator

I know this subject is touched on a lot and in a lot more depth than this will be. I wanted to give my two cents though.

I recently had a peer who needed to migrate a group of VMs to another data store. For whatever reason they wouldn’t go because of the attached cd-rom drive had an ISO from the original data store attached. My co-worker asked me to help him out and go through and remove the cd-drive from them manually. With a few hundred VMs that would have taken a few hours. I did some quick googling and found the below command which took care of it in under 5 minutes. Like the saying goes, work smarter not harder. This left us available for more important work that needed to get done.


Breaking down the command we get all VMs that equal powered on, then passed through get-cddrive which passes through the drive info to set drive to no media. Worked like a charm. After this I showed him how to run the command to move all VMs on a data store. This took a full day of work to less than an hours (I’m saying an hour because I did have to look up the commands) Now I have them in my repo though and can use them on demand in the future.

Get-VM | Where-Object {$_.PowerState –eq “PoweredOn”} | Get-CDDrive | Set-CDDrive -NoMedia -Confirm:$False

Get-VM -Datastore Datastore1 | Move-VM -Datastore Datastore2





Comments are closed.
%d bloggers like this: