Move SMSPKG folder to another drive in Configuration Manager 2012 R2

One of my customers had an issue with it’s software distribution, after deploying multiple secondary sites under the same primary he did send about a thousand packages to these secondary.
Unfortunately the primary was not properly configured and the wrong drive was used to store the compressed version of the packages. As a result the drive went full and the primary site started to fail.
The issue is that there is no “easy” way to change the drive, as it was the case with SCCM 2007 (could be done from the console).
In addition, once the folder has been created on the drive, SCCM will always use it either or not a NO_SMS_ON_DRIVE.SMS flag exists.
The only supported method to move this folder now is by using the SCCM 2012 R2 SDK.
Here is the process used:
Start wbemtest.exe as administrator and connect to the site namespace (rootsmssite_XXX)
Click on “Enum Classes”, match recursive and then ok. Look for the class “SMS_SCI_Component” and click “Add”
Click on “Instances” and look for the “SMS_DISTRIBUTION_MANAGER” of your site (select the appropriate site because all sites components will be listed!)
Click on “Add” and in the “propertie” window look for “Props” then double click on it.
Click on “view embedded”
You will get a window with many embedded properties without a specific name.
Unfortunately, you have to look manually for the proper “embedded Property” which is the “Package Root Directory”
Edit “Value1” and set the drive letter that you want to use (I’ll use D: for my demo, the folder is set to C: at the moment) then click on “save property”
Click on close, close, save Property, save object, close, save object, close, close, close and then exit the wbemtest window.
Restart the Distribution Manager thread or simply restart sms_executive service.
The next time you will send a package to a remote site you should see from the sender.log of the primary site an entry about the creation of the share on the new drive.
In my case I only have a local DP so I can see the entry into the distributionmanager.log.
In addition you can also check the new setting directly in SQL by opening the XML file resulting of the query select * from vSMS_SC_SiteControlXML
Look for the entry “Package Root Directory” and you will see the new value set
After executing this process you will be able to delete the old SMSPKG folder.