Are these one of the scenarios you faced in your environment?
You don't have space in default C drive and always wanted to move Inetpub to D drive.
By mistake someone configured few webservers on C drive and couple of them on D drive, in farm environment it caused issues while deploying the code base.
One of your environment is already configured in C drive long back and now you have a policy/scripts which will only work in D drive. You want to move to D drive and make this environment similar to your production/cob environment.
If you answered yes to any one of the above, then you are reading the right article. Lets follow the below steps to move Inetpub with sharepoint websites from C drive to D drive.
Backup the current registry and Change all the registry settings as below.
Make sure IIS is stopped. Take a backup of metabase.xml under Inetsrv. Do find/replace from C:\Inetpub to D:\Inetpub for all references.
Now copy C:\inetpub directory to D drive and give the same permission for the directory similar to C:\inetpub.
Login to Server which contains sharepoint databases. Run the below query against sharepoint configuration database. This will give all the webapplications which are created in C drive.
select * from objects where properties like '%C:\inetpub\wwwroot\wss\virtualdirectories\%'
Now we need to update all these references to D drive as we are moving from C drive.
We need to run the below powershell script to update the configuration database.