How to change the SharePoint web application physical IIS physical path

Recently, I needed to change the physical path of an already existing SPWebApplication.
This feature is not available from the Central Administration user interface. Of course the first option will be using SharePoint Management Shell.

Here are the steps to do that:

# Get the SPWebApplication using its url or id
$app = Get-SPWebApplication http://servername:port
# Display the currently set iis physical path
# Create a directory info object with the new required path
$newPathDirectoryInfo = New-Object -TypeName System.IO.DirectoryInfo -Argument List "F:\WebApplications\80"
# Assign the new directory info to the application iis settings
$app.IisSettings[[Microsoft.SharePoint.Administration.SPUrlZone]::Default].Path = $newPathDirectoryInfo
# Update the application

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: