PLEASE READ FIRST!

I've now been blogging here since 2007! ...Wow, has it been that long already?! Over the years, I've covered a wide array of subjects from scripting, troubleshooting, to the occasional hobby project. I have literally heard from thousands of you over the years with questions or even just offering me a bit of thanks!

Recently, I quit my full-time job and started work on an IT business, Rhythm IT Solutions, helping other IT departments manage their IT environments. We're offering consulting & professional services (Office 365 Migrations, Network Discovery, Firewall Management, etc...) as well as Endpoint Management (AV, Patch Management EDR, Managed Backup, etc...)



If there is something (on my blog or not) that you could use some additional help with, I would LOVE to hear from you! Please feel free to reach out to me using the contact links here or the contact form on Rhythm's website.

For those wondering, I do plan on continuing my work on the blog. So don't worry! There are plenty of Greg Strike posts yet to come! 😊 Thanks for stopping by!

PLEASE READ FIRST!




I wrote this PowerShell function to change drive letters with PowerShell and DiskPart. Other methods posted online utilize the Win32_Volume WMI class which is not available in Windows XP. Using DiskPart makes the function compatible with Windows XP/2003 as well as Vista/2008/7.

Also, note the method used to detect whether or not a drive exists. I use this method vs. Test-Path as Test-Path can return (what I consider) False-Falses. If you run Test-Path on a CD-ROM or other drive letter without any media, it will return False even though the drive letter itself is in use.

function ChangeDriveLetter($Current, $New){
 $CurrentDrive = New-Object System.IO.DriveInfo($Current)
 $NewDrive = New-Object System.IO.DriveInfo($New)

 if (($CurrentDrive.DriveType -ne "NoRootDirectory") -and ($NewDrive.DriveType -eq "NoRootDirectory")){
  Write-Host("Changing drive letter from " + $Current + " to " + $New + "...")
  "select volume " + $Current + [char]13 + [char]10 + "assign letter " + $New | diskpart > $Null
  Return $True
 } else {
  Write-Error("Can not change drive letter.  Either " + $Current + ":\ doesn't exist or " + $New + ":\ already exists.")
  Return $False
 }
}


PLEASE READ FIRST!

I've now been blogging here since 2007! ...Wow, has it been that long already?! Over the years, I've covered a wide array of subjects from scripting, troubleshooting, to the occasional hobby project. I have literally heard from thousands of you over the years with questions or even just offering me a bit of thanks!

Recently, I quit my full-time job and started work on an IT business, Rhythm IT Solutions, helping other IT departments manage their IT environments. We're offering consulting & professional services (Office 365 Migrations, Network Discovery, Firewall Management, etc...) as well as Endpoint Management (AV, Patch Management EDR, Managed Backup, etc...)



If there is something (on my blog or not) that you could use some additional help with, I would LOVE to hear from you! Please feel free to reach out to me using the contact links here or the contact form on Rhythm's website.

For those wondering, I do plan on continuing my work on the blog. So don't worry! There are plenty of Greg Strike posts yet to come! 😊 Thanks for stopping by!

PLEASE READ FIRST!





Gregory Strike

Husband, father, IT dude & blogger wrapped up into one good looking package.