Forum Discussion
LanceLyons
Feb 02, 2024Copper Contributor
Looking for Powershell approach to deploying a Visual Studio web package zip file
We have been using ADO to deploy web package zip files to IIS sites. Now looking at some work in Harness and need a Powershell approach to deploying these same zip files. the deploy approach h...
Kidd_Ip
Mar 20, 2025MVP
How about this:
Steps to Deploy Using PowerShell
1. Install Web Deploy:
- Download Web Deploy and install on the target server.
2. Extract the Package:
- If needed, extract the zip file to inspect its contents. However, Web Deploy can work directly with the zip file.
3. Use MSDeploy Command:
- PowerShell can invoke the msdeploy.exe command to deploy the package:
$packagePath = "C:\Path\To\YourPackage.zip"
$siteName = "YourIISSiteName"
$destination = "IIS Web Application Name"
& "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" `
-source:package="$packagePath" `
-dest:auto,computerName="https://YourServerName:8172/msdeploy.axd?site=$siteName",userName="YourUsername",password="YourPassword",authType="Basic" `
-setParam:name="IIS Web Application Name",value="$destination" `
-verbose
- Replace the placeholders with your actual values:
- $packagePath: Path to your zip file.
- $siteName: Name of the IIS site.
- $destination: Target application name in IIS.
- YourServerName, YourUsername, and YourPassword: Server and credentials.
4. Customize Parameters:
- If your package includes parameters.xml, you can use the -setParam option to override parameters during deployment.
5. Automate with PowerShell:
- Wrap the above command in a PowerShell script to automate deployments.