PowerShell script for IIS installation
m ((username removed) (log details removed))
(Added Edited template with July 12, 2025.)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
PowerShells script for automated installation on Windows and IIS. The script can create and update a .Net Core installation of TurnKey or MDrivenServer on Windows.
{{Edited|July|12|2025}}
<message>Write the content here to display this box</message>
This is a PowerShells script for automated installation on Windows and IIS. The script can create and update a .Net Core installation of TurnKey or MDrivenServer on Windows.


(please see this page for basic installation for .net core on Windows [[MDrivenServerCore in IIS]])
(Please see this page for basic installation for .net core on Windows: [[Documentation:MDrivenServerCore in IIS|MDrivenServerCore in IIS]])


Please consider this for web sites on IIS.
Consider this for websites on IIS:


* "Site" is the name of the website, which also points to the physical path on the server
# "Site" is the name of the website, which also points to the physical path on the server.
** The site holds information on "bindings", which is to say, which protocols and certificates that should be used.
#* The site holds information on "bindings", which is to say, which protocols and certificates should be used.
# A subfolder of a site usually looks like a "subsite" of a site, for example of the "Default Web Site".
#* "Subsite" doesn't really exist, but can have application information assigned to it.
# "Application" is information stored in the site that points to an AppPool.
# "AppPool" is the settings for the process that will process requests of the an Application.
# An application can be hosted in the site root, or in subfolders, i.e. subsites.


* A subfolder of a site usually looks like a "subsite" of a site, for example of the "Default Web Site"
** "Subsite" doesn't really exist, but can have application information assigned to it.
* "Application" is information stored in the site that points to an AppPool


* "AppPool" is the settings for the process that will process requests of the an Application
'''NOTE!''' The certificate MUST be valid for the MDrivenServer to start. An MDrivenServer talks to itself and needs to be able to accept it's own certificate.
* An application can be hosted in the site root, or in subfolders, i.e. subsites.  


Having the above in mind, these are the parameters to the script:


This script has the following parameters:


'''NOTE!''' The certificate MUST be valid for the MDrivenServer to start. A MDrivenServer talks to itself and needs to be able to accept it's own certificate.
* '''appName''' - The name of the application, but also the siteName, if you set appInOwnSite to $true
* '''siteName'''  - Default to the default site of a standard installed IIS, "Default Web Site".


Having the above in mind, this is the parameters to the script;
* '''appURL'''  - The public URL that clients access this site, must be provided. For example: ''app.company.com''


This script has the following parameters;
* '''certFriendlyName''' - The friendly name of a certificate that the script will try to attach to the site binding.


* appName The name of the application, but also the siteName if you set appInOwnSite to $true
* '''appInOwnSite''' - Default is $false - $false puts the app as subsite to the app with $siteName. $true uses a siteName the same as the app name for each app.
* siteName  Default to the default site of a standard installed IIS, "Default Web Site"


* appURL  The public URL that clients access this site, must be provided. For example ''app.company.com''
* '''appInSiteRoot''' - Defaults to $false, which means that a subfolder will be created in the Site folder.


* certFriendlyName The friendly name of a certificate that the script will try to attach to the site binding.
* '''inetpubPath''' - Default to "%SystemDrive%\inetpub", and you usually don't need to provide this.


* appInOwnSite Default is $false  $false puts the app as subsite to the app with $siteName. $true uses a siteName the same as the app name for each app
* '''cleanSite''' - Default to $false, which will leave existing files in the site folder. $true will delete all files except settings and database files.
 
* '''$updateFile''' - If provided, updates the site from this zip-file. If only file name (without path), the current user's Download folder will be used to find the file.
* appInSiteRoot Defaults to $false, which means that a subfolder will be created in the Site folder
 
* inetpubPath Default to "%SystemDrive%\inetpub", and you usually don't need to provide this
 
* cleanSite Default to $false, which will leave existing files in the site folder. $true will delete all files except settings and database files.
* $updateFile If provided, updates the site from this zip-file. If only file name (without path), the current users Download folder will be used to find the file.


[[File:CreateOrUpdateCoreSite.zip|alt=CreateOrUpdateCoreSite.ps1]]
[[File:CreateOrUpdateCoreSite.zip|alt=CreateOrUpdateCoreSite.ps1]]

Latest revision as of 06:34, 20 January 2025

This page was created by Lars.olofsson@mdriven.net on 2024-04-13. Last edited by Edgar on 2025-01-20.


This is a PowerShells script for automated installation on Windows and IIS. The script can create and update a .Net Core installation of TurnKey or MDrivenServer on Windows.

(Please see this page for basic installation for .net core on Windows: MDrivenServerCore in IIS)

Consider this for websites on IIS:

  1. "Site" is the name of the website, which also points to the physical path on the server.
    • The site holds information on "bindings", which is to say, which protocols and certificates should be used.
  2. A subfolder of a site usually looks like a "subsite" of a site, for example of the "Default Web Site".
    • "Subsite" doesn't really exist, but can have application information assigned to it.
  3. "Application" is information stored in the site that points to an AppPool.
  4. "AppPool" is the settings for the process that will process requests of the an Application.
  5. An application can be hosted in the site root, or in subfolders, i.e. subsites.


NOTE! The certificate MUST be valid for the MDrivenServer to start. An MDrivenServer talks to itself and needs to be able to accept it's own certificate.

Having the above in mind, these are the parameters to the script:

This script has the following parameters:

  • appName - The name of the application, but also the siteName, if you set appInOwnSite to $true
  • siteName  - Default to the default site of a standard installed IIS, "Default Web Site".
  • appURL - The public URL that clients access this site, must be provided. For example: app.company.com
  • certFriendlyName - The friendly name of a certificate that the script will try to attach to the site binding.
  • appInOwnSite - Default is $false - $false puts the app as subsite to the app with $siteName. $true uses a siteName the same as the app name for each app.
  • appInSiteRoot - Defaults to $false, which means that a subfolder will be created in the Site folder.
  • inetpubPath - Default to "%SystemDrive%\inetpub", and you usually don't need to provide this.
  • cleanSite - Default to $false, which will leave existing files in the site folder. $true will delete all files except settings and database files.
  • $updateFile - If provided, updates the site from this zip-file. If only file name (without path), the current user's Download folder will be used to find the file.

File:CreateOrUpdateCoreSite.zip