salt.modules.win_iis module

Microsoft IIS site management via WebAdministration powershell module

platform:Windows

New in version 2016.3.0.

salt.modules.win_iis.create_app(name, site, sourcepath, apppool=None)

Create an IIS application.

Parameters:
  • name (str) -- The IIS application.
  • site (str) -- The IIS site name.
  • sourcepath (str) -- The physical path.
  • apppool (str) -- The name of the IIS application pool.
Returns:

A boolean representing whether all changes succeeded.

Return type:

bool

CLI Example:

salt '*' win_iis.create_app name='app0' site='site0' sourcepath='C:\site0' apppool='site0'
salt.modules.win_iis.create_apppool(name)

Create an IIS application pool.

Parameters:name (str) -- The name of the IIS application pool.
Returns:A boolean representing whether all changes succeeded.
Return type:bool

CLI Example:

salt '*' win_iis.create_apppool name='MyTestPool'
salt.modules.win_iis.create_binding(site, hostheader='', ipaddress='*', port=80, protocol='http', sslflags=0)

Create an IIS binding.

Parameters:
  • site (str) -- The IIS site name.
  • hostheader (str) -- The host header of the binding.
  • ipaddress (str) -- The IP address of the binding.
  • port (str) -- 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.
Returns:

A boolean representing whether all changes succeeded.

Return type:

bool

CLI Example:

salt '*' win_iis.create_binding site='site0' hostheader='example' ipaddress='*' port='80'
salt.modules.win_iis.create_cert_binding(name, site, hostheader='', ipaddress='*', port=443, sslflags=0)

Assign a certificate to an IIS binding.

Parameters:
  • 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 (str) -- The TCP port of the binding.
  • sslflags (str) -- Flags representing certificate type and certificate storage of the binding.
Returns:

A boolean representing whether all changes succeeded.

Return type:

bool

New in version 2016.11.0.

CLI Example:

salt '*' win_iis.create_cert_binding name='AAA000' site='site0' hostheader='example' ipaddress='*' port='443'
salt.modules.win_iis.create_site(name, sourcepath, apppool='', hostheader='', ipaddress='*', port=80, protocol='http')

Create a basic website in IIS.

Parameters:
  • 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.
  • ipaddress (str) -- The IP address of the binding.
  • port (str) -- The TCP port of the binding.
  • protocol (str) -- The application protocol of the binding.
Returns:

A boolean representing whether all changes succeeded.

Return type:

bool

CLI Example:

salt '*' win_iis.create_site name='My Test Site' sourcepath='c:\stage' apppool='TestPool'
salt.modules.win_iis.create_vdir(name, site, sourcepath, app='/')

Create an IIS virtual directory.

Parameters:
  • name (str) -- The virtual directory name.
  • site (str) -- The IIS site name.
  • sourcepath (str) -- The physical path.
  • app (str) -- The IIS application.
Returns:

A boolean representing whether all changes succeeded.

Return type:

bool

CLI Example:

salt '*' win_iis.create_vdir name='vd0' site='site0' sourcepath='C:\inetpub\vdirs\vd0'
salt.modules.win_iis.get_container_setting(name, container, settings)

Get the value of the setting for the IIS container.

Parameters:
  • name (str) -- The name of the IIS container.
  • container (str) -- The type of IIS container. The container types are: AppPools, Sites, SslBindings
  • settings (str) -- A dictionary of the setting names and their values.
Returns:

A dictionary of the provided settings and their values.

Return type:

dict

New in version 2016.11.0.

CLI Example:

salt '*' win_iis.get_container_setting name='MyTestPool' container='AppPools'
    settings="['processModel.identityType']"
salt.modules.win_iis.list_apppools()

List all configured IIS application pools.

Returns:A dictionary of IIS application pools and their details.
Return type:dict

CLI Example:

salt '*' win_iis.list_apppools
salt.modules.win_iis.list_apps(site)

Get all configured IIS applications for the specified site.

Parameters:site (str) -- The IIS site name.
Returns:A dictionary of the application names and properties.
Return type:dict

CLI Example:

salt '*' win_iis.list_apps site
salt.modules.win_iis.list_bindings(site)

Get all configured IIS bindings for the specified site.

Parameters:site (str) -- The IIS site name.
Returns:A dictionary of the binding names and properties.
Return type:dict

CLI Example:

salt '*' win_iis.list_bindings site
salt.modules.win_iis.list_cert_bindings(site)

List certificate bindings for an IIS site.

Parameters:site (str) -- The IIS site name.
Returns:A dictionary of the binding names and properties.
Return type:dict

New in version 2016.11.0.

CLI Example:

salt '*' win_iis.list_bindings site
salt.modules.win_iis.list_sites()

List all the currently deployed websites.

Returns:A dictionary of the IIS sites and their properties.
Return type:dict

CLI Example:

salt '*' win_iis.list_sites
salt.modules.win_iis.list_vdirs(site, app='/')

Get all configured IIS virtual directories for the specified site, or for the combination of site and application.

Parameters:
  • site (str) -- The IIS site name.
  • app (str) -- The IIS application.
Returns:

A dictionary of the virtual directory names and properties.

Return type:

dict

CLI Example:

salt '*' win_iis.list_vdirs site
salt.modules.win_iis.remove_app(name, site)

Remove an IIS application.

Parameters:
  • name (str) -- The application name.
  • site (str) -- The IIS site name.
Returns:

A boolean representing whether all changes succeeded.

Return type:

bool

CLI Example:

salt '*' win_iis.remove_app name='app0' site='site0'
salt.modules.win_iis.remove_apppool(name)

Remove an IIS application pool.

Parameters:name (str) -- The name of the IIS application pool.
Returns:A boolean representing whether all changes succeeded.
Return type:bool

CLI Example:

salt '*' win_iis.remove_apppool name='MyTestPool'
salt.modules.win_iis.remove_binding(site, hostheader='', ipaddress='*', port=80)

Remove an IIS binding.

Parameters:
  • site (str) -- The IIS site name.
  • hostheader (str) -- The host header of the binding.
  • ipaddress (str) -- The IP address of the binding.
  • port (str) -- The TCP port of the binding.
Returns:

A boolean representing whether all changes succeeded.

Return type:

bool

CLI Example:

salt '*' win_iis.remove_binding site='site0' hostheader='example' ipaddress='*' port='80'
salt.modules.win_iis.remove_cert_binding(name, site, hostheader='', ipaddress='*', port=443)

Remove a certificate from an IIS binding.

Parameters:
  • 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 (str) -- The TCP port of the binding.

New in version 2016.11.0.

CLI Example:

salt '*' win_iis.remove_cert_binding name='AAA000' site='site0' hostheader='example' ipaddress='*' port='443'
salt.modules.win_iis.remove_site(name)

Delete a website from IIS.

Parameters:name (str) -- The IIS site name.
Returns:A boolean representing whether all changes succeeded.
Return type:bool

CLI Example:

salt '*' win_iis.remove_site name='My Test Site'
salt.modules.win_iis.remove_vdir(name, site, app='/')

Remove an IIS virtual directory.

Parameters:
  • name (str) -- The virtual directory name.
  • site (str) -- The IIS site name.
  • app (str) -- The IIS application.
Returns:

A boolean representing whether all changes succeeded.

Return type:

bool

CLI Example:

salt '*' win_iis.remove_vdir name='vdir0' site='site0'
salt.modules.win_iis.restart_apppool(name)

Restart an IIS application pool.

Parameters:name (str) -- The name of the IIS application pool.
Returns:A boolean representing whether all changes succeeded.
Return type:bool

New in version 2016.11.0.

CLI Example:

salt '*' win_iis.restart_apppool name='MyTestPool'
salt.modules.win_iis.set_container_setting(name, container, settings)

Set the value of the setting for an IIS container.

Parameters:
  • name (str) -- The name of the IIS container.
  • container (str) -- The type of IIS container. The container types are: AppPools, Sites, SslBindings
  • settings (str) -- A dictionary of the setting names and their values.
Returns:

A boolean representing whether all changes succeeded.

Return type:

bool

New in version 2016.11.0.

CLI Example:

salt '*' win_iis.set_container_setting name='MyTestPool' container='AppPools'
    settings="{'managedPipeLineMode': 'Integrated'}"