In this PowerShell tutorial, we will discuss how to perform IIS backup using PowerShell.
IIS backup and restore using PowerShell
If you are using IIS7 then there is a PowerShell command to backup your IIS data.
Please follow the below steps to take the Backup of your IIS.
Backing up an IIS configuration
Step 1: Login to the Windows Powershell using Administrator mode.
Step 2: Next copy the below command and paste it Powershell and click on enter to execute the command
Backup-WebConfiguration -Name RAJIISBACKUP
Step 3: After execute this command by default Backups are stored in the C:\Windows\System32\inetsrv\backup
directory.
Restores an IIS configuration backup
Now, we will see how to restore an IIS configuration backup using PowerShell.
Restore-WebConfiguration -Name RAJIISBACKUP
Note: Please take care while providing the name of your backup file. If the filename already exists, then it will return an error. So make sure you are providing the unique backup name.
You may like following tutorials:
- Recycle IIS Application pool: The local SharePoint server is not available
- How to do an IISReset in all the servers in a SharePoint Farm?
- Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))
This is how We can do IIS backup and restore using PowerShell.
Rajkiran is currently working as a SharePoint Consultant in India . Rajkiran having 7+ years of experience in Microsoft Technologies such as SharePoint 2019/2016/2013/2010, MOSS 2007,WSS 3.0, Migration, Asp.Net, C#.Net, Sql Server, Ajax, jQuery etc.He is C#Corner MVP (2 Times).