Microsoft IIS site management via WebAdministration powershell module
Shane Lee <slee@saltstack.com>, Robert Booth <rbooth@saltstack.com>
Windows
PowerShell
WebAdministration module (PowerShell) (IIS)
New in version 2016.3.0.
Create an IIS application.
Note
This function only validates against the application name, and will return True even if the application already exists with a different configuration. It will not modify the configuration of an existing application.
True if successful, otherwise False
CLI Example:
salt '*' win_iis.create_app name='app0' site='site0' sourcepath='C:\site0' apppool='site0'
Create an IIS application pool.
Note
This function only validates against the application pool name, and will return True even if the application pool already exists with a different configuration. It will not modify the configuration of an existing application pool.
name (str) -- The name of the IIS application pool.
True if successful, otherwise False
CLI Example:
salt '*' win_iis.create_apppool name='MyTestPool'
Backup an IIS Configuration on the System.
New in version 2017.7.0.
Note
Backups are stored in the $env:Windir\System32\inetsrv\backup
folder.
name (str) -- The name to give the backup
True if successful, otherwise False
CLI Example:
salt '*' win_iis.create_backup good_config_20170209
Create an IIS Web Binding.
Note
This function only validates against the binding ipaddress:port:hostheader combination, and will return True even if the binding already exists with a different configuration. It will not modify the configuration of an existing binding.
site (str) -- The IIS site name.
hostheader (str) -- The host header of the binding. Usually a hostname.
ipaddress (str) -- The IP address of the binding.
port (int) -- The TCP port of the binding.
protocol (str) -- The application protocol of the binding.
sslflags (str) -- The flags representing certificate type and storage of the binding.
True if successful, otherwise False
CLI Example:
salt '*' win_iis.create_binding site='site0' hostheader='example.com' ipaddress='*' port='80'
Assign a certificate to an IIS Web Binding.
New in version 2016.11.0.
Note
The web binding that the certificate is being assigned to must already exist.
name (str) -- The thumbprint of the certificate.
site (str) -- The IIS site name.
hostheader (str) -- The host header of the binding.
ipaddress (str) -- The IP address of the binding.
port (int) -- The TCP port of the binding.
sslflags (int) -- Flags representing certificate type and certificate storage of the binding.
True if successful, otherwise False
CLI Example:
salt '*' win_iis.create_cert_binding name='AAA000' site='site0' hostheader='example.com' ipaddress='*' port='443'
Create a basic website in IIS.
Note
This function only validates against the site name, and will return True even if the site already exists with a different configuration. It will not modify the configuration of an existing site.
name (str) -- The IIS site name.
sourcepath (str) -- The physical path of the IIS site.
apppool (str) -- The name of the IIS application pool.
hostheader (str) -- The host header of the binding. Usually the hostname or website name, ie: www.contoso.com
ipaddress (str) -- The IP address of the binding.
port (int) -- The TCP port of the binding.
protocol (str) -- The application protocol of the binding. (http, https, etc.)
True if successful, otherwise False.
Note
If an application pool is specified, and that application pool does not already exist, it will be created.
CLI Example:
salt '*' win_iis.create_site name='My Test Site' sourcepath='c:\stage' apppool='TestPool'
Create an IIS virtual directory.
Note
This function only validates against the virtual directory name, and will return True even if the virtual directory already exists with a different configuration. It will not modify the configuration of an existing virtual directory.
True if successful, otherwise False
CLI Example:
salt '*' win_iis.create_vdir name='vd0' site='site0' sourcepath='C:\inetpub\vdirs\vd0'
Get the value of the setting for the IIS container.
New in version 2016.11.0.
A dictionary of the provided settings and their values.
CLI Example:
salt '*' win_iis.get_container_setting name='MyTestPool' container='AppPools'
settings="['processModel.identityType']"
New in version 2017.7.0.
Get the value of the setting for the IIS web application.
Note
Params are case sensitive
A dictionary of the provided settings and their values.
CLI Example:
salt '*' win_iis.get_webapp_settings name='app0' site='Default Web Site'
settings="['physicalPath','applicationPool']"
Get the webconfiguration settings for the IIS PSPath.
A list of dictionaries containing setting name, filter and value.
CLI Example:
salt '*' win_iis.get_webconfiguration_settings name='IIS:\' settings="[{'name': 'enabled', 'filter': 'system.webServer/security/authentication/anonymousAuthentication'}]"
List all configured IIS application pools.
A dictionary of IIS application pools and their details.
CLI Example:
salt '*' win_iis.list_apppools
Get all configured IIS applications for the specified site.
site (str) -- The IIS site name.
Returns: A dictionary of the application names and properties.
CLI Example:
salt '*' win_iis.list_apps site
List the IIS Configuration Backups on the System.
New in version 2017.7.0.
Note
Backups are made when a configuration is edited. Manual backups are
stored in the $env:Windir\System32\inetsrv\backup
folder.
A dictionary of IIS Configurations backed up on the system.
CLI Example:
salt '*' win_iis.list_backups
Get all configured IIS bindings for the specified site.
site (str) -- The name if the IIS Site
A dictionary of the binding names and properties.
CLI Example:
salt '*' win_iis.list_bindings site
List certificate bindings for an IIS site.
New in version 2016.11.0.
site (str) -- The IIS site name.
A dictionary of the binding names and properties.
CLI Example:
salt '*' win_iis.list_bindings site
List all the currently deployed websites.
A dictionary of the IIS sites and their properties.
CLI Example:
salt '*' win_iis.list_sites
Get all configured IIS virtual directories for the specified site, or for the combination of site and application.
A dictionary of the virtual directory names and properties.
CLI Example:
salt '*' win_iis.list_vdirs site
Returns a list of worker processes that correspond to the passed application pool.
New in version 2017.7.0.
apppool (str) -- The application pool to query
A dictionary of worker processes with their process IDs
CLI Example:
salt '*' win_iis.list_worker_processes 'My App Pool'
Modify an IIS Web Binding. Use site
and binding
to target the
binding.
New in version 2017.7.0.
site (str) -- The IIS site name.
binding (str) -- The binding to edit. This is a combination of the
IP address, port, and hostheader. It is in the following format:
ipaddress:port:hostheader. For example, *:80:
or
*:80:salt.com
hostheader (str) -- The host header of the binding. Usually the hostname.
ipaddress (str) -- The IP address of the binding.
port (int) -- The TCP port of the binding.
sslflags (str) -- The flags representing certificate type and storage of the binding.
True if successful, otherwise False
CLI Example:
The following will seat the host header of binding *:80:
for site0
to example.com
salt '*' win_iis.modify_binding site='site0' binding='*:80:' hostheader='example.com'
Modify a basic website in IIS.
New in version 2017.7.0.
True if successful, otherwise False.
Note
If an application pool is specified, and that application pool does not already exist, it will be created.
CLI Example:
salt '*' win_iis.modify_site name='My Test Site' sourcepath='c:\new_path' apppool='NewTestPool'
Remove an IIS application.
True if successful, otherwise False
CLI Example:
salt '*' win_iis.remove_app name='app0' site='site0'
Remove an IIS application pool.
name (str) -- The name of the IIS application pool.
True if successful, otherwise False
CLI Example:
salt '*' win_iis.remove_apppool name='MyTestPool'
Remove an IIS Configuration backup from the System.
New in version 2017.7.0.
name (str) -- The name of the backup to remove
True if successful, otherwise False
CLI Example:
salt '*' win_iis.remove_backup backup_20170209
Remove an IIS binding.
True if successful, otherwise False
CLI Example:
salt '*' win_iis.remove_binding site='site0' hostheader='example.com' ipaddress='*' port='80'
Remove a certificate from an IIS Web Binding.
New in version 2016.11.0.
Note
This function only removes the certificate from the web binding. It does not remove the web binding itself.
True if successful, otherwise False
CLI Example:
salt '*' win_iis.remove_cert_binding name='AAA000' site='site0' hostheader='example.com' ipaddress='*' port='443'
Delete a website from IIS.
name (str) -- The IIS site name.
True if successful, otherwise False
Note
This will not remove the application pool used by the site.
CLI Example:
salt '*' win_iis.remove_site name='My Test Site'
Remove an IIS virtual directory.
True if successful, otherwise False
CLI Example:
salt '*' win_iis.remove_vdir name='vdir0' site='site0'
Restart an IIS application pool.
New in version 2016.11.0.
name (str) -- The name of the IIS application pool.
True if successful, otherwise False
CLI Example:
salt '*' win_iis.restart_apppool name='MyTestPool'
Restart a Web Site in IIS.
New in version 2017.7.0.
name (str) -- The name of the website to restart.
True if successful, otherwise False
CLI Example:
salt '*' win_iis.restart_site name='My Test Site'
Set the value of the setting for an IIS container.
New in version 2016.11.0.
True if successful, otherwise False
CLI Example:
salt '*' win_iis.set_container_setting name='MyTestPool' container='AppPools'
settings="{'managedPipeLineMode': 'Integrated'}"
New in version 2017.7.0.
Configure an IIS application.
Note
This function only configures an existing app. Params are case sensitive.
name (str) -- The IIS application.
site (str) -- The IIS site name.
settings (str) -- A dictionary of the setting names and their values. - physicalPath: The physical path of the webapp. - applicationPool: The application pool for the webapp. - userName: "connectAs" user - password: "connectAs" password for user
A boolean representing whether all changes succeeded.
CLI Example:
salt '*' win_iis.set_webapp_settings name='app0' site='site0' settings="{'physicalPath': 'C:\site0', 'apppool': 'site0'}"
Set the value of the setting for an IIS container.
True if successful, otherwise False
CLI Example:
salt '*' win_iis.set_webconfiguration_settings name='IIS:\' settings="[{'name': 'enabled', 'filter': 'system.webServer/security/authentication/anonymousAuthentication', 'value': False}]"
Start an IIS application pool.
New in version 2017.7.0.
name (str) -- The name of the App Pool to start.
True if successful, otherwise False
CLI Example:
salt '*' win_iis.start_apppool name='MyTestPool'
Start a Web Site in IIS.
New in version 2017.7.0.
name (str) -- The name of the website to start.
True if successful, otherwise False
CLI Example:
salt '*' win_iis.start_site name='My Test Site'