{"id":1537,"date":"2015-01-04T23:04:08","date_gmt":"2015-01-04T15:04:08","guid":{"rendered":"http:\/\/www.jhouseconsulting.com\/?p=1537"},"modified":"2016-06-26T23:47:33","modified_gmt":"2016-06-26T15:47:33","slug":"script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives","status":"publish","type":"post","link":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537","title":{"rendered":"Script to Change the Drive Letter of all CDROM and DVD Drives"},"content":{"rendered":"<p><a href=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2015\/01\/CD.jpg\"><img decoding=\"async\" class=\"alignleft wp-image-1545 \" title=\"CD\" src=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2015\/01\/CD.jpg\" alt=\"CD\" width=\"115\" height=\"117\" \/><\/a><\/p>\n<p>This PowerShell script will change the drive letter of all CDROM &amp; DVD Drives\u00a0found starting from whatever is set as $LastDriveLetter variable, working\u00a0backwards until it finds an available drive letter.<\/p>\n<p>Too many IT Pros leave\u00a0CDROM\/DVD Drives as the drive letter Windows assigns them when first detected, which is typically usually either D: or E:. Then when adding new volumes they choose the next available drive letter instead of moving the CDROM\/DVD Drive(s) out of the way. I&#8217;m a stickler for this, as I like to see consecutive drives letters used for the logical disks.<\/p>\n<p>The easiest way to\u00a0ensure all builds are standardised is to run a script during the build process that assigns a new drive letter to the connected\u00a0CDROM\/DVD Drive(s).<!--more--><\/p>\n<p>I actually use this script in my MDT Task Sequences as per the following screen shot.<\/p>\n<p><a href=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2015\/01\/MDT-Task-Sequence-ChangeCDRomDriveLetter.ps1_.png\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-1539\" title=\"MDT Task Sequence-ChangeCDRomDriveLetter.ps1\" src=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2015\/01\/MDT-Task-Sequence-ChangeCDRomDriveLetter.ps1_.png\" alt=\"MDT Task Sequence-ChangeCDRomDriveLetter.ps1\" width=\"700\" height=\"625\" srcset=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2015\/01\/MDT-Task-Sequence-ChangeCDRomDriveLetter.ps1_.png 726w, https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2015\/01\/MDT-Task-Sequence-ChangeCDRomDriveLetter.ps1_-300x268.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>Remember that if you&#8217;re running the script from an MDT Task\u00a0Sequence, you&#8217;re deployment share will already be mapped to Z:\u00a0drive, so you&#8217;re CDROM\/DVD drive will typically end up as Y:.<\/p>\n<p>Update 26th June 2016: On several recent projects I have been challenged with a clashing CD\/DVD Drive letter with customer drive mappings.\u00a0At the end of the day leaving a CD\/DVD drive in the image provides no benefits, and is often more of a hindrance.\u00a0So I just enhanced the script to remove the drive letter using the -Remove parameter as per the following screen shot. This also saves me having to remove the CD\/DVD device from the target VMs.<\/p>\n<p><a href=\"http:\/\/www.jhouseconsulting.com\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537\/mdt-task-sequence-remove-cdrom-drive-letter\"><img decoding=\"async\" class=\"aligncenter wp-image-1662\" title=\"MDT Task Sequence-Remove-CDRom-Drive-Letter\" src=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2015\/01\/MDT-Task-Sequence-Remove-CDRom-Drive-Letter.png\" alt=\"MDT Task Sequence-Remove-CDRom-Drive-Letter\" width=\"700\" height=\"624\" srcset=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2015\/01\/MDT-Task-Sequence-Remove-CDRom-Drive-Letter.png 731w, https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2015\/01\/MDT-Task-Sequence-Remove-CDRom-Drive-Letter-300x268.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>The script is thoroughly documented.<\/p>\n<p>Here is the <a  data-e-Disable-Page-Transition=\"true\" class=\"download-link\" title=\"\" href=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/download\/1541\/?tmstv=1784710198\" rel=\"nofollow\" id=\"download-link-1541\" data-redirect=\"false\" >\n\tChangeCDRomDriveLetter.ps1\t(2746 downloads\t)\n<\/a>\n\u00a0script:<\/p>\n<pre class=\"brush: powershell; auto-links: false; title: ; toolbar: false; notranslate\" title=\"\">\r\n&lt;#\r\n  This script will change or remove the drive letter of all CDROM\r\n  &amp; DVD Drives found. If changing the drive letters, it will start\r\n  from whatever is set as $LastDriveLetter, working backwards until\r\n  it finds an available drive letter.\r\n\r\n  Example 1: If you have 1 CDROM\/DVD drive mounted as D: and there\r\n             is nothing using Z:, it will change the CDROM\/DVD to\r\n             Z: However, if Z: is already in use, it will use Y:\r\n             instead, and so on.\r\n\r\n  Example 2: If you have 2 CDROM\/DVD drives mounted as D: and E:, \r\n             it will change the CDROM\/DVD on E: to Z: and D: to Y:.\r\n             However, if Z: or Y: are already in use, it will use\r\n             the next available drive letter.\r\n\r\n  The whole point is to get them out of the way so that they\r\n  don't interfere with DiskPart, etc.\r\n\r\n  Remember that if you're running the script from an MDT Task\r\n  Sequence, you're deployment share will already be mapped to Z:\r\n  drive, so you're CDROM\/DVD drive will typically end up as Y:.\r\n\r\n  Syntax Examples:\r\n\r\n  - Run the script without parameters to default to Z as the\r\n    drive letter to start from:\r\n      ChangeCDRomDriveLetter.ps1\r\n\r\n  - To specify T as the drive letter to start from:\r\n      ChangeCDRomDriveLetter.ps1 -LastDriveLetter:t\r\n\r\n  - To remove the drive letter from existing CDROM\/DVD drive(s):\r\n      ChangeCDRomDriveLetter.ps1 -Remove\r\n\r\n  Script Name: ChangeCDRomDriveLetter.ps1\r\n  Release 1.3\r\n  Written by Jeremy@jhouseconsulting.com 8th December 2014\r\n  Modified by Jeremy@jhouseconsulting.com 14th May 2016\r\n\r\n#&gt;\r\n#-------------------------------------------------------------\r\nparam(&#x5B;string]$LastDriveLetter,&#x5B;switch]$Remove)\r\n\r\n# Set Powershell Compatibility Mode\r\nSet-StrictMode -Version 2.0\r\n\r\n# Enable verbose output\r\n$VerbosePreference = 'Continue' \r\n\r\nIf (&#x5B;String]::IsNullOrEmpty($LastDriveLetter)) {\r\n  $LastDriveLetter = &quot;z&quot;\r\n}\r\n\r\n#-------------------------------------------------------------\r\n\r\nGet-WmiObject win32_logicaldisk -filter 'DriveType=5' | Sort-Object -property DeviceID -Descending | ForEach-Object { \r\n    Write-Verbose &quot;Found CDROM drive on $($_.DeviceID)&quot;\r\n    $a = mountvol $_.DeviceID \/l\r\n    # Get first free drive letter starting from Z: and working backwards.\r\n    # Many scripts on the Internet recommend using the following line:\r\n    # $UseDriveLetter = Get-ChildItem function:&#x5B;d-$LastDriveLetter]: -Name | Where-Object {-not (Test-Path -Path $_)} | Sort-Object -Descending | Select-Object -First 1\r\n    # However, if you run Test-Path on a CD-ROM or other drive letter\r\n    # without any media, it will return False even though the drive letter\r\n    # itself is in use. So to ensure accuracy we use the following line:\r\n    $UseDriveLetter = Get-ChildItem function:&#x5B;d-$LastDriveLetter]: -Name | Where-Object { (New-Object System.IO.DriveInfo($_)).DriveType -eq 'NoRootDirectory' } | Sort-Object -Descending | Select-Object -First 1\r\n    If ($UseDriveLetter -ne $null -AND $UseDriveLetter -ne &quot;&quot;) {\r\n      If ($Remove -eq $False) {\r\n        Write-Verbose &quot;$UseDriveLetter is available to use&quot;\r\n        Write-Verbose &quot;Changing $($_.DeviceID) to $UseDriveLetter&quot;\r\n      }\r\n      mountvol $_.DeviceID \/d\r\n      Write-Verbose &quot;Unmounted volume for $($_.DeviceID) completed with an exit code of $LastExitCode&quot;\r\n      If ($Remove -eq $False) {\r\n        $a = $a.Trim()\r\n        mountvol $UseDriveLetter $a\r\n        Write-Verbose &quot;Mounting volume to $UseDriveLetter completed with an exit code of $LastExitCode&quot;\r\n      }\r\n    } else {\r\n      Write-Verbose &quot;No available drive letters found.&quot;\r\n    }\r\n  }\r\n\r\n$ExitCode = 0\r\nWrite-Verbose &quot;Completed with an exit code of $ExitCode&quot;\r\nExit $ExitCode\r\n<\/pre>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This PowerShell script will change the drive letter of all CDROM &amp; DVD Drives\u00a0found starting from whatever is set as $LastDriveLetter variable, working\u00a0backwards until it finds an available drive letter. Too many IT Pros leave\u00a0CDROM\/DVD Drives as the drive letter Windows assigns them when first detected, which is typically usually either D: or E:. Then &#8230; <a title=\"Script to Change the Drive Letter of all CDROM and DVD Drives\" class=\"read-more\" href=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537\" aria-label=\"Read more about Script to Change the Drive Letter of all CDROM and DVD Drives\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[388,389,5],"tags":[398,400,399,390,391,341,340],"class_list":["post-1537","post","type-post","status-publish","format-standard","hentry","category-mdt","category-osd","category-scripting","tag-cdrom-drive","tag-change-letter","tag-dvd-drive","tag-mdt","tag-osd","tag-posh","tag-powershell"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"This PowerShell script will change the drive letter of all CDROM &amp; DVD Drives found starting from whatever is set as $LastDriveLetter variable, working backwards until it finds an available drive letter. Too many IT Pros leave CDROM\/DVD Drives as the drive letter Windows assigns them when first detected, which is typically usually either D: or E:. Then\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Jeremy Saunders\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"J House Consulting - DevOps, Microsoft, Citrix &amp; Desktop Virtualisation (VDI) Specialist - +61 413 441 846 - Delivering customer success through technology: IT Infrastructure | Citrix | End User Computing | Platform Engineering | DevOps | Full Stack Developer | Technical Architect | Improvisor | Aspiring Comedian | Midlife Adventurer\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Script to Change the Drive Letter of all CDROM and DVD Drives - J House Consulting - DevOps, Microsoft, Citrix &amp; Desktop Virtualisation (VDI) Specialist - +61 413 441 846\" \/>\n\t\t<meta property=\"og:description\" content=\"This PowerShell script will change the drive letter of all CDROM &amp; DVD Drives found starting from whatever is set as $LastDriveLetter variable, working backwards until it finds an available drive letter. Too many IT Pros leave CDROM\/DVD Drives as the drive letter Windows assigns them when first detected, which is typically usually either D: or E:. Then\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2025\/06\/Blog-Banner-White-JeremySaunders-1.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2025\/06\/Blog-Banner-White-JeremySaunders-1.png\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2015-01-04T15:04:08+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2016-06-26T15:47:33+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Script to Change the Drive Letter of all CDROM and DVD Drives - J House Consulting - DevOps, Microsoft, Citrix &amp; Desktop Virtualisation (VDI) Specialist - +61 413 441 846\" \/>\n\t\t<meta name=\"twitter:description\" content=\"This PowerShell script will change the drive letter of all CDROM &amp; DVD Drives found starting from whatever is set as $LastDriveLetter variable, working backwards until it finds an available drive letter. Too many IT Pros leave CDROM\/DVD Drives as the drive letter Windows assigns them when first detected, which is typically usually either D: or E:. Then\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2025\/06\/Blog-Banner-White-JeremySaunders-1.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/2015\\\/01\\\/04\\\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#blogposting\",\"name\":\"Script to Change the Drive Letter of all CDROM and DVD Drives - J House Consulting - DevOps, Microsoft, Citrix & Desktop Virtualisation (VDI) Specialist - +61 413 441 846\",\"headline\":\"Script to Change the Drive Letter of all CDROM and DVD Drives\",\"author\":{\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/author\\\/jeremy#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/wp-content\\\/uploads\\\/2015\\\/01\\\/CD.jpg\",\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/2015\\\/01\\\/04\\\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537\\\/#articleImage\",\"width\":80,\"height\":82,\"caption\":\"CD\"},\"datePublished\":\"2015-01-04T23:04:08+08:00\",\"dateModified\":\"2016-06-26T23:47:33+08:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/2015\\\/01\\\/04\\\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/2015\\\/01\\\/04\\\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#webpage\"},\"articleSection\":\"MDT, OSD, Scripting, CDROM Drive, Change letter, DVD Drive, MDT, OSD, POSH, PowerShell\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/2015\\\/01\\\/04\\\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/category\\\/scripting#listItem\",\"name\":\"Scripting\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/category\\\/scripting#listItem\",\"position\":2,\"name\":\"Scripting\",\"item\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/category\\\/scripting\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/2015\\\/01\\\/04\\\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#listItem\",\"name\":\"Script to Change the Drive Letter of all CDROM and DVD Drives\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/2015\\\/01\\\/04\\\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#listItem\",\"position\":3,\"name\":\"Script to Change the Drive Letter of all CDROM and DVD Drives\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/category\\\/scripting#listItem\",\"name\":\"Scripting\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/#organization\",\"name\":\"J House Consulting - DevOps, Microsoft, Citrix & Desktop Virtualisation (VDI) Specialist - +61 413 441 846\",\"description\":\"Delivering customer success through technology: IT Infrastructure | Citrix | End User Computing | Platform Engineering | DevOps | Full Stack Developer | Technical Architect | Improvisor | Aspiring Comedian | Midlife Adventurer\",\"url\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/Blog-Banner-White-JeremySaunders-1.png\",\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/2015\\\/01\\\/04\\\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537\\\/#organizationLogo\",\"width\":1020,\"height\":200},\"image\":{\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/2015\\\/01\\\/04\\\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537\\\/#organizationLogo\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/author\\\/jeremy#author\",\"url\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/author\\\/jeremy\",\"name\":\"Jeremy Saunders\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/2015\\\/01\\\/04\\\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f2d27bd3d985e6ef2024dded7c713b14440d467a6a0100aede3cfefcb4ab20f1?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Jeremy Saunders\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/2015\\\/01\\\/04\\\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#webpage\",\"url\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/2015\\\/01\\\/04\\\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537\",\"name\":\"Script to Change the Drive Letter of all CDROM and DVD Drives - J House Consulting - DevOps, Microsoft, Citrix & Desktop Virtualisation (VDI) Specialist - +61 413 441 846\",\"description\":\"This PowerShell script will change the drive letter of all CDROM & DVD Drives found starting from whatever is set as $LastDriveLetter variable, working backwards until it finds an available drive letter. Too many IT Pros leave CDROM\\\/DVD Drives as the drive letter Windows assigns them when first detected, which is typically usually either D: or E:. Then\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/2015\\\/01\\\/04\\\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/author\\\/jeremy#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/author\\\/jeremy#author\"},\"datePublished\":\"2015-01-04T23:04:08+08:00\",\"dateModified\":\"2016-06-26T23:47:33+08:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/#website\",\"url\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/\",\"name\":\"J House Consulting - DevOps, Microsoft, Citrix & Desktop Virtualisation (VDI) Specialist - +61 413 441 846\",\"description\":\"Delivering customer success through technology: IT Infrastructure | Citrix | End User Computing | Platform Engineering | DevOps | Full Stack Developer | Technical Architect | Improvisor | Aspiring Comedian | Midlife Adventurer\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.jhouseconsulting.com\\\/jhouseconsulting\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Script to Change the Drive Letter of all CDROM and DVD Drives - J House Consulting - DevOps, Microsoft, Citrix & Desktop Virtualisation (VDI) Specialist - +61 413 441 846","description":"This PowerShell script will change the drive letter of all CDROM & DVD Drives found starting from whatever is set as $LastDriveLetter variable, working backwards until it finds an available drive letter. Too many IT Pros leave CDROM\/DVD Drives as the drive letter Windows assigns them when first detected, which is typically usually either D: or E:. Then","canonical_url":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#blogposting","name":"Script to Change the Drive Letter of all CDROM and DVD Drives - J House Consulting - DevOps, Microsoft, Citrix & Desktop Virtualisation (VDI) Specialist - +61 413 441 846","headline":"Script to Change the Drive Letter of all CDROM and DVD Drives","author":{"@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/author\/jeremy#author"},"publisher":{"@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2015\/01\/CD.jpg","@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537\/#articleImage","width":80,"height":82,"caption":"CD"},"datePublished":"2015-01-04T23:04:08+08:00","dateModified":"2016-06-26T23:47:33+08:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#webpage"},"isPartOf":{"@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#webpage"},"articleSection":"MDT, OSD, Scripting, CDROM Drive, Change letter, DVD Drive, MDT, OSD, POSH, PowerShell"},{"@type":"BreadcrumbList","@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting#listItem","position":1,"name":"Home","item":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting","nextItem":{"@type":"ListItem","@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/category\/scripting#listItem","name":"Scripting"}},{"@type":"ListItem","@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/category\/scripting#listItem","position":2,"name":"Scripting","item":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/category\/scripting","nextItem":{"@type":"ListItem","@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#listItem","name":"Script to Change the Drive Letter of all CDROM and DVD Drives"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#listItem","position":3,"name":"Script to Change the Drive Letter of all CDROM and DVD Drives","previousItem":{"@type":"ListItem","@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/category\/scripting#listItem","name":"Scripting"}}]},{"@type":"Organization","@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/#organization","name":"J House Consulting - DevOps, Microsoft, Citrix & Desktop Virtualisation (VDI) Specialist - +61 413 441 846","description":"Delivering customer success through technology: IT Infrastructure | Citrix | End User Computing | Platform Engineering | DevOps | Full Stack Developer | Technical Architect | Improvisor | Aspiring Comedian | Midlife Adventurer","url":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/","logo":{"@type":"ImageObject","url":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2025\/06\/Blog-Banner-White-JeremySaunders-1.png","@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537\/#organizationLogo","width":1020,"height":200},"image":{"@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537\/#organizationLogo"}},{"@type":"Person","@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/author\/jeremy#author","url":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/author\/jeremy","name":"Jeremy Saunders","image":{"@type":"ImageObject","@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/f2d27bd3d985e6ef2024dded7c713b14440d467a6a0100aede3cfefcb4ab20f1?s=96&d=mm&r=g","width":96,"height":96,"caption":"Jeremy Saunders"}},{"@type":"WebPage","@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#webpage","url":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537","name":"Script to Change the Drive Letter of all CDROM and DVD Drives - J House Consulting - DevOps, Microsoft, Citrix & Desktop Virtualisation (VDI) Specialist - +61 413 441 846","description":"This PowerShell script will change the drive letter of all CDROM & DVD Drives found starting from whatever is set as $LastDriveLetter variable, working backwards until it finds an available drive letter. Too many IT Pros leave CDROM\/DVD Drives as the drive letter Windows assigns them when first detected, which is typically usually either D: or E:. Then","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/#website"},"breadcrumb":{"@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537#breadcrumblist"},"author":{"@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/author\/jeremy#author"},"creator":{"@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/author\/jeremy#author"},"datePublished":"2015-01-04T23:04:08+08:00","dateModified":"2016-06-26T23:47:33+08:00"},{"@type":"WebSite","@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/#website","url":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/","name":"J House Consulting - DevOps, Microsoft, Citrix & Desktop Virtualisation (VDI) Specialist - +61 413 441 846","description":"Delivering customer success through technology: IT Infrastructure | Citrix | End User Computing | Platform Engineering | DevOps | Full Stack Developer | Technical Architect | Improvisor | Aspiring Comedian | Midlife Adventurer","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/#organization"}}]},"og:locale":"en_US","og:site_name":"J House Consulting - DevOps, Microsoft, Citrix &amp; Desktop Virtualisation (VDI) Specialist - +61 413 441 846 - Delivering customer success through technology: IT Infrastructure | Citrix | End User Computing | Platform Engineering | DevOps | Full Stack Developer | Technical Architect | Improvisor | Aspiring Comedian | Midlife Adventurer","og:type":"article","og:title":"Script to Change the Drive Letter of all CDROM and DVD Drives - J House Consulting - DevOps, Microsoft, Citrix &amp; Desktop Virtualisation (VDI) Specialist - +61 413 441 846","og:description":"This PowerShell script will change the drive letter of all CDROM &amp; DVD Drives found starting from whatever is set as $LastDriveLetter variable, working backwards until it finds an available drive letter. Too many IT Pros leave CDROM\/DVD Drives as the drive letter Windows assigns them when first detected, which is typically usually either D: or E:. Then","og:url":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537","og:image":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2025\/06\/Blog-Banner-White-JeremySaunders-1.png","og:image:secure_url":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2025\/06\/Blog-Banner-White-JeremySaunders-1.png","article:published_time":"2015-01-04T15:04:08+00:00","article:modified_time":"2016-06-26T15:47:33+00:00","twitter:card":"summary_large_image","twitter:title":"Script to Change the Drive Letter of all CDROM and DVD Drives - J House Consulting - DevOps, Microsoft, Citrix &amp; Desktop Virtualisation (VDI) Specialist - +61 413 441 846","twitter:description":"This PowerShell script will change the drive letter of all CDROM &amp; DVD Drives found starting from whatever is set as $LastDriveLetter variable, working backwards until it finds an available drive letter. Too many IT Pros leave CDROM\/DVD Drives as the drive letter Windows assigns them when first detected, which is typically usually either D: or E:. Then","twitter:image":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2025\/06\/Blog-Banner-White-JeremySaunders-1.png"},"aioseo_meta_data":{"post_id":"1537","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2025-07-04 13:43:09","updated":"2025-07-04 13:43:09","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/category\/scripting\" title=\"Scripting\">Scripting<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tScript to Change the Drive Letter of all CDROM and DVD Drives\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting"},{"label":"Scripting","link":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/category\/scripting"},{"label":"Script to Change the Drive Letter of all CDROM and DVD Drives","link":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2015\/01\/04\/script-to-change-the-drive-letter-of-all-cdrom-and-dvd-drives-1537"}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/posts\/1537","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/comments?post=1537"}],"version-history":[{"count":8,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/posts\/1537\/revisions"}],"predecessor-version":[{"id":1664,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/posts\/1537\/revisions\/1664"}],"wp:attachment":[{"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/media?parent=1537"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/categories?post=1537"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/tags?post=1537"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}