Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

PowerShell – Change Windows CD/DVD Drive Letter

Posted on May 14, 2018 By David Kittell
# Set CD/DVD Drive to A:
$cd = $NULL
$cd = Get-WMIObject -Class Win32_CDROMDrive -ComputerName $env:COMPUTERNAME -ErrorAction Stop 
if ($cd.Drive -eq "D:")
{
   Write-Output "Changing CD Drive letter from D: to A:"
   Set-WmiInstance -InputObject ( Get-WmiObject -Class Win32_volume -Filter "DriveLetter = 'd:'" ) -Arguments @{DriveLetter='a:'}
}
# Set CD/DVD Drive to A:
Get-WmiObject -Class Win32_volume -Filter 'DriveType=5' |
  Select-Object -First 1 |
  Set-WmiInstance -Arguments @{DriveLetter='A:'}
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code PowerShell Windows

Post navigation

Previous post
Next post

Related Posts

Remove Last N Characters From Column

Posted on September 9, 2015

Recently in a project to list all the plugins in a WordPress site with their versions I had accidently added .0 on to various rows in error. This script was very helpful to correct this error SELECT [id], [siteid], [pluginid], [versioninstalled], LEFT([versioninstalled], LEN([versioninstalled]) – 2), [Activated] FROM [Documentation].[dbo].[tblWP_SiteToPlugin] WHERE RIGHT([versioninstalled],…

Read More

UNIX – Create Sudoers Access

Posted on August 5, 2016August 5, 2016

# Variables – Start username="dkittell" # Variables – Stop su # type in sudo password chmod -v +w /etc/sudoers && echo -e "$username ALL=(ALL) ALL" >> /etc/sudoers && chmod -v -w /etc/sudoers # Variables – Start username="dkittell" # Variables – Stop su # type in sudo password # Remove Sudoers…

Read More

Coding Standards

Posted on July 11, 2013October 26, 2015

=============================== MercuryBoard Coding Standards =============================== Please follow these guidelines when modifying or adding to the MercuryBoard source. They are slightly modified PEAR (http://pear.php.net) coding standards. Indenting and Space ===================== Use an indent of 1 tab. After the first non-tab character on a line, spaces should be used for whitespace. There…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • PowerShell - IIS Remove Site
  • Front Page
  • SQLite - Auto-Increment / Auto Generate GUID
  • PowerShell - FTP Upload Directory With Sub-Directories

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • PowerShell - IIS Remove Site
  • SQLite - Auto-Increment / Auto Generate GUID
  • PowerShell - FTP Upload Directory With Sub-Directories
  • Raspberry Pi - Remove Default Apps
  • PowerShell - Change Windows CD/DVD Drive Letter
©2025 David Kittell | WordPress Theme by SuperbThemes