Here are a few scripts that you can use to manage your IIS Webserver on Windows Server.
You can run these scripts either with PowerShell or Command Prompt (as Admin User)
Let’s write the command to export all the Application Pools, you will need to use the list command and a destination directory to export the configuration of the application pools as XML file.
Start with Changing the Working directory to inetsrv
cd inetsrv, then:
.\appcmd list apppool /config /xml > D:\inetpub\AppPools.XML
#If you just need to export a single application pool you can use the following command
.\appcmd list apppool “AppPoolName” /config /xml > C:\Temp\AppPoolName.XML
#Similarly for exporting sites you can use the following command it works in the same way as that of AppPool
.\appcmd list site /config /xml > C:\Temp\Sites.XML
#For a single site use following command.
.\appcmd list site “SiteName” /config /xml > C:\Temp\SiteName.XML
# This would save the XML file in C:\Temp directory.
You can now copy these files to C:\Temp directory of the server where you need to import the websites and its configuration.
#All Done!
#Provided by WindowServer.Org
You can download the above Script from Here