Powershell – Moving one website from one server to another using powershell

msdeploypowershellwindows-server-2008-r2windows-server-2012-r2

I've been reading about MS Deploy and writing a small script to export/import one website from one server to another server(IIS8 to IIS8). But I ran into sizing problems and some other errors and the whole process seems to be overkill for one website.

So I'm wondering if there's an easier way of doing it through the powershell? Using powershell, Is there a way to export and import a site? Googling to reveal much, but I'm thinking there's got to be a way.

Thanks

Best Answer

I did end up using msdeploy:

Export:

C:\Program Files\IIS\Microsoft Web Deploy V3>msdeploy.exe -verb:sync -source:apphostconfig="myWebSite" -enableLink:AppPoolExtension -dest:archivedir=c:\NavProd.zip,encryptPassword=myPassWord > wdPackage.log

Import:

C:\Program Files\IIS\Microsoft Web Deploy V3>msdeploy.exe -verb:sync -source:archivedir=c:\myWebSite.zip,encryptPassword=myPassWord -enableLink:AppPoolExtension - dest:apphostconfig="myWebSite" > wddeploy.log