🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
PowerShell script for IIS installation
This page was created by Wikiadmin on 2026-07-29. Last edited by Wikiadmin on 2026-07-29.

You can use the CreateOrUpdateCoreSite PowerShell script to create or update a .NET Core MDriven Turnkey or MDrivenServer application hosted by IIS on Windows.

The script automates IIS site, application, application pool, binding, and deployment-folder handling. Use it when you want a repeatable installation or update instead of creating these IIS objects manually.

Before you run the script

Prepare the server as described in Documentation:Deploying MDriven Server & Turnkey Core on IIS. That guide covers the .NET Core IIS prerequisites, application-pool configuration, bindings, and the MDriven configuration files required after deployment.

Before running the script, make sure that:

  • IIS is installed and configured for the .NET Core application you plan to host.
  • You run PowerShell with administrative permissions. The script creates or changes IIS configuration.
  • You know the public host name that users will use, such as app.company.com.
  • A certificate exists whose friendly name matches the value you provide in certFriendlyName.
  • The certificate is valid for the host name in appURL.
  • If you are updating an application, you have the update ZIP file available.

Certificate requirement

MDrivenServer communicates with itself. Its IIS certificate must therefore be valid for the URL used by the server. Do not use a hostname that the certificate does not cover, and do not rely on ignoring a browser certificate warning.

For example, if clients access the application at https://app.company.com, use a certificate valid for app.company.com and set appURL to app.company.com.

For certificate creation and IIS binding guidance, see HowTos:Installing MDriven Server on Windows.

Understand the IIS structure

The script works with IIS sites, applications, application pools, and folders. These names are related, but they are not interchangeable.

Term Meaning in IIS Example
Site An IIS website. It has a physical path and one or more bindings, which define protocol, port, host name, and certificate. Default Web Site with an HTTPS binding for app.company.com.
Application An IIS configuration entry that maps a URL path to a physical folder and an application pool. An application named Sales under Default Web Site.
Application pool (AppPool) The process settings used to handle requests for an IIS application. The application pool assigned to Sales.
“Subsite” An informal name for a folder or URL below a site. IIS does not have a separate subsite object; the folder can instead be configured as an application. Default Web Site/Sales.

An application can be located at the root of a site or below a site path. The appInOwnSite and appInSiteRoot parameters determine which layout you use.

Get the script and update package

The script is distributed as CreateOrUpdateCoreSite.zip. Extract the archive to a local folder before running the contained PowerShell script.

For an update, obtain the ZIP package containing the MDriven Turnkey or MDrivenServer version you intend to deploy. The script uses updateFile to locate that package.

If you instead want to automate package deployment with Web Deploy and command files, see HowTos:Automate Deployment of Turnkey and MDrivenServer on IIS.

Choose the deployment layout

Choose the layout before you run the script.

Goal Parameter choice Example result
Host the application below an existing site Set appInOwnSite to $false. This is the default. Application Sales is created below Default Web Site.
Create a separate IIS site for the application Set appInOwnSite to $true. A site named Sales is used for the application.
Host the application at the selected site's root Set appInSiteRoot to $true. The application is hosted at the root URL of its site rather than in an application subfolder.

For example, a shared-site installation can use Default Web Site as the site name and Sales as the application name. A separate-site installation uses Sales as the application name and, when appInOwnSite is $true, also uses Sales as the site name.

Run a create or update deployment

  1. Open PowerShell as Administrator.
  2. Change to the folder where you extracted CreateOrUpdateCoreSite.zip.
  3. Run the script and provide the required application URL, application name, and certificate friendly name.
  4. Set the site-layout parameters that match the IIS layout you selected.
  5. Provide updateFile when you are updating from a ZIP package.
  6. After the script completes, test the URL that uses the hostname covered by the certificate.

The exact command line depends on the script file contained in the archive. Use the parameter names in the following table when supplying values.

Script parameters

Parameter Default Purpose Example value
appName None stated The application name. When appInOwnSite is $true, this is also the IIS site name. Sales
siteName Default Web Site The existing IIS site that hosts the application when appInOwnSite is $false. Default Web Site
appURL Required The public hostname that clients use to reach the application. It must correspond to the IIS binding and certificate. app.company.com
certFriendlyName None stated The friendly name of the certificate that the script attaches to the site binding. Company App Certificate
appInOwnSite $false Controls whether the application is created in its own IIS site. When $true, the site name is the application name. $true
appInSiteRoot $false Controls whether the application is hosted at the site root. When $false, the script creates a subfolder in the site folder. $true
inetpubPath %SystemDrive%\inetpub The base IIS folder path. You normally do not need to change it. D:\inetpub
cleanSite $false Controls whether existing site files are removed during deployment. When $true, the script deletes files except settings and database files. $true
updateFile Not provided The ZIP file used to update the site. If you give only a file name, the script looks for it in the current user's Downloads folder. MDrivenTurnkey_20220321.zip

Update-file lookup

Use a full path when the ZIP is not in the current user's Downloads folder. For example, if the package is stored in a release folder, provide its full path rather than only its file name. If you provide only MDrivenTurnkey_20220321.zip, the script searches the current user's Downloads folder for that file.

Cleaning an existing site

Leave cleanSite at $false for a normal update when you need existing site files retained. Set it to $true only when you intend to remove existing files other than settings and database files.

Treat cleanSite as a destructive deployment option. Confirm the target application and its physical folder before using it.

Verify the deployment

After the script creates or updates the application:

  1. Open IIS Manager and confirm that the intended site, application, application pool, and binding exist.
  2. Browse to the application using the public URL represented by appURL.
  3. Confirm that the browser does not report a certificate-name error.
  4. If you deployed MDrivenServer or MDriven Turnkey Core, complete the application-specific configuration in Documentation:Deploying MDriven Server & Turnkey Core on IIS. This includes using the same binding URL in the required override configuration files.
  5. If startup fails, inspect the IIS and application logs, then follow HowTos:Troubleshooting IIS application startup issues.

Related deployment options

This PowerShell script is intended for IIS-hosted .NET Core applications. For a manual Windows and IIS installation, see HowTos:Installing MDriven Server on Windows. For local development with IIS Express, see Documentation:IIS Express.

See also