Browse All Articles
> Moving Inetput to different drive with Sharepoint websites
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.
$SPSite = new-object Microsoft.SharePoint.SPSite("http://mywebapp:24333")
$WebApp = $SPSite.WebApplication
#IIS zone under which webapplication is created.
$IISSettings = $WebApp.IisSettings[[Microsoft.SharePoint.Administration.SPUrlZone]::Default]
#Change to new path
$IISSettings.Path = "D:\wss\VirtualDirectories\24333"
#update and dispose
#End powershell script
Now the trick part is moving the websites created by extending to different zones and ssp.
So you need to change the IISettings i.e
For example if the website you have created is in internet/intranet it would be like this
For moving webapplication with Shared Service Provider(SSP) the zone will be default but the change will be in SP site object. It should be like this...
[code]$SPSite = new-object Microsoft.SharePoint.SPSite("http://mywebapp:24333/ssp/admin")
So run the powershell script by make all these appropriate changes to all the sites for sharepoint.
Run the below query to check the configuration database is updated.
select * from objects where properties like '%d:\inetpub\wwwroot\wss\v
: Start the IIS and remove/backup the C:\inetpub directory. Browse your sharepoint websites to make sure there is no issue.
This way it helps you to spend only 30 minutes to move from C drive to D drive rather than spending 1 or 2 days to completely remove all Sharepoint websites and reinstall them completely on the D drive. It saves more time and effort if you have lot of Sharepoint websites or sites with heavily customized features and code.