neulab/tldr huggingface dataset:
salt.modules.win_dacl.check_inheritance(path, objectType, user=None) Check a specified path to verify if inheritance is enabled
• path -- path of the registry key or file system object to check
• user -- if provided, will consider only the ACEs for that user
Returns (bool): 'Inheritance' of True/False
salt 'minion-id' win_dacl.check_inheritance c:  emp directory <username>
class salt.modules.win_dacl.daclConstants DACL constants used throughout the module
getAceTypeBit(t) returns the acetype bit of a text value
getAceTypeText(t) returns the textual representation of a acetype bit
getObjectTypeBit(t) returns the bit value of the string object type
getPermissionBit(t, m) returns a permission bit of the string permission value for the specified object type
getPermissionText(t, m) returns the permission textual representation of a specified permission bit/object type
getPropagationBit(t, p) returns the propagation bit of a text value
getPropagationText(t, p) returns the textual representation of a propagation bit
getSecurityHkey(s) returns the necessary string value for an HKEY for the win32security module
processPath(path, objectType)
processes a path/object type combo and returns: registry types with the correct HKEY text representation files/directories with environment variables expanded
salt.modules.win_dacl.disable_inheritance(path, objectType, copy=True) Disable inheritance on an object
• path -- The path to the object
• copy -- True will copy the Inherited ACEs to the DACL before disabling inheritance
Returns (dict): A dictionary containing the results
salt 'minion-id' win_dacl.disable_inheritance c:        emp directory
salt.modules.win_dacl.enable_inheritance(path, objectType, clear=False) enable/disable inheritance on an object
• clear -- True will remove non-Inherited ACEs from the ACL
salt 'minion-id' win_dacl.enable_inheritance c: emp directory
salt.modules.win_dacl.get(path, objectType, user=None) Get the ACL of an object. Will filter by user if one is provided.
• user -- A user name to filter by
Returns (dict): A dictionary containing the ACL
salt 'minion-id' win_dacl.get c:        emp directory
salt.modules.win_dacl.rm_ace(path, objectType, user, permission=None, acetype=None, propagation=None) remove an ace to an object
path:  path to the object (i.e. c:\temp\file, HKEY_LOCAL_MACHINE\SOFTWARE\KEY, etc) user: user to remove permission:  permissions for the user acetypes:  either allow/deny for each user/permission (ALLOW, DENY) propagation: how the ACE applies to children for Registry Keys and Directories(KEY, KEY&SUBKEYS, SUBKEYS)
If any of the optional parameters are omitted (or set to None) they act as wildcards.
remove allow domain\fakeuser full control on HKLM\\SOFTWARE\\somekey propagated to this key and subkeys salt 'myminion' win_dacl.rm_ace 'Registry' 'HKEY_LOCAL_MACHINE\\SOFTWARE\\somekey' 'domain\fakeuser' 'FULLCONTROL' 'ALLOW' 'KEY&SUBKEYS'
salt.modules.win_disk Module for gathering disk information on Windows
• win32api Python module
salt.modules.win_disk.usage() Return usage information for volumes mounted on this minion
salt.modules.win_dism Install features/packages for Windows using DISM, which is useful for minions not running server versions of Windows. Some functions are only available on Windows 10.
salt.modules.win_dism.add_capability(capability, source=None, limit_access=False, image=None, restart=False) Install a capability
• capability (str) -- The capability to install
• source (Optional[str]) -- The optional source of the capability. Default is set by group policy and can be Windows Update.
• limit_access (Optional[bool]) -- Prevent DISM from contacting Windows Update for the source package
• image (Optional[str]) -- The path to the root directory of an offline Windows image. If None is passed, the running operating system is targeted. Default is None.
• restart (Optional[bool]) -- Reboot the machine if required by the install
• NotImplementedError -- For all versions of Windows that are not Windows 10
• and later. Server editions of Windows use ServerManager instead. --
Returns A dictionary containing the results of the command
salt '*' dism.add_capability Tools.Graphics.DirectX~~~~0.0.1.0
salt.modules.win_dism.add_feature(feature, package=None, source=None, limit_access=False, enable_parent=False, image=None, restart=False) Install a feature using DISM
• feature (str) -- The feature to install
• package (Optional[str]) -- The parent package for the feature. You do not have to specify the package if it is the Windows Foundation Package.  Otherwise, use package to specify the parent package of the feature
• source (Optional[str]) -- The optional source of the capability. Default is set by group policy and can be Windows Update
• enable_parent (Optional[bool]) -- True will enable all parent features of the specified feature
salt '*' dism.add_feature NetFx3
salt.modules.win_dism.add_package(package, ignore_check=False, prevent_pending=False, image=None, restart=False) Install a package using DISM
• package (str) --
The package to install. Can be a .cab file, a .msu file, or a folder
NOTE: An .msu package is supported only when the target image is offline, either mounted or applied.
• ignore_check (Optional[bool]) -- Skip installation of the package if the applicability checks fail
• prevent_pending (Optional[bool]) -- Skip the installation of the package if there are pending online actions
• image (Optional[str]) -- The path to the root directory of an offline Windows image. If None is passed, the running operating system is targeted.  Default is None.
salt '*' dism.add_package C:\Packages\package.cab
salt.modules.win_dism.available_capabilities(image=None) List the capabilities available on the system
Parameters image (Optional[str]) -- The path to the root directory of an offline Windows image. If None is passed, the running operating system is targeted. Default is None.
Returns A list of available capabilities
salt '*' dism.installed_capabilities
salt.modules.win_dism.available_features(image=None) List the features available on the system
Returns A list of available features
salt '*' dism.available_features
salt.modules.win_dism.get_capabilities(image=None) List all capabilities on the system
Returns A list of capabilities
salt '*' dism.get_capabilities
salt.modules.win_dism.get_features(package=None, image=None) List features on the system or in a package
• package (Optional[str]) --
The full path to the package. Can be either a .cab file or a folder. Should point to the original source of the package, not to where the file is installed. You cannot use this command to get package information for .msu files
This can also be the name of a package as listed in dism.installed_packages
Returns A list of features
# Return all features on the system salt '*' dism.get_features
# Return all features in package.cab salt '*' dism.get_features C:\packages\package.cab
# Return all features in the calc package salt '*' dism.get_features Microsoft.Windows.Calc.Demo~6595b6144ccf1df~x86~en~1.0.0.0
salt.modules.win_dism.installed_capabilities(image=None) List the capabilities installed on the system
Returns A list of installed capabilities
salt.modules.win_dism.installed_features(image=None) List the features installed on the system
Returns A list of installed features
salt '*' dism.installed_features
salt.modules.win_dism.installed_packages(image=None) List the packages installed on the system
salt '*' dism.installed_packages
salt.modules.win_dism.package_info(package, image=None) Display information about a package
• package (str) -- The full path to the package. Can be either a .cab file or a folder. Should point to the original source of the package, not to where the file is installed. You cannot use this command to get package information for .msu files
salt '*' dism. package_info C:\packages\package.cab
salt.modules.win_dism.remove_capability(capability, image=None, restart=False) Uninstall a capability
• capability (str) -- The capability to be removed
salt '*' dism.remove_capability Tools.Graphics.DirectX~~~~0.0.1.0
salt.modules.win_dism.remove_feature(feature, remove_payload=False, image=None, restart=False) Disables the feature.
• feature (str) -- The feature to uninstall
• remove_payload (Optional[bool]) -- Remove the feature's payload. Must supply source when enabling in the future.
salt '*' dism.remove_feature NetFx3
salt.modules.win_dism.remove_package(package, image=None, restart=False) Uninstall a package
• package (str) -- The full path to the package. Can be either a .cab file or a folder. Should point to the original source of the package, not to where the file is installed. This can also be the name of a package as listed in dism.installed_packages
# Remove the Calc Package salt '*' dism.remove_package Microsoft.Windows.Calc.Demo~6595b6144ccf1df~x86~en~1.0.0.0
# Remove the package.cab (does not remove C:\packages\package.cab) salt '*' dism.remove_package C:\packages\package.cab
salt.modules.win_dns_client Module for configuring DNS Client on Windows systems
salt.modules.win_dns_client.add_dns(ip, interface='Local Area Connection', index=1) Add the DNS server to the network interface (index starts from 1)
Note: if the interface DNS is configured by DHCP, all the DNS servers will be removed from the interface and the requested DNS will be the only one
salt '*' win_dns_client.add_dns <ip> <interface> <index>
salt.modules.win_dns_client.dns_dhcp(interface='Local Area Connection') Configure the interface to get its DNS servers from the DHCP server
salt '*' win_dns_client.dns_dhcp <interface>
salt.modules.win_dns_client.get_dns_config(interface='Local Area Connection') Get the type of DNS configuration (dhcp / static).
• interface (str) -- The name of the network interface. This is the
• in the Network Connection Details for the device (Description) --
Returns True if DNS is configured, otherwise False
salt '*' win_dns_client.get_dns_config 'Local Area Connection'
salt.modules.win_dns_client.get_dns_servers(interface='Local Area Connection') Return a list of the configured DNS servers of the specified interface
• interface (str) -- The name of the network interface. This is the name as
• appears in the Control Panel under Network Connections (it) --
Returns A list of dns servers
salt '*' win_dns_client.get_dns_servers 'Local Area Connection'
salt.modules.win_dns_client.rm_dns(ip, interface='Local Area Connection') Remove the DNS server from the network interface
salt '*' win_dns_client.rm_dns <ip> <interface>
salt.modules.win_dsc Module for working with Windows PowerShell DSC (Desired State Configuration)
This module is Alpha
This module applies DSC Configurations in the form of PowerShell scripts or MOF (Managed Object Format) schema files.
Use the psget module to manage PowerShell resources.
The idea is to leverage Salt to push DSC configuration scripts or MOF files to the Minion.
• PowerShell 5.0
salt.modules.win_dsc.apply_config(path, source=None, salt_env='base') Run an compiled DSC configuration (a folder containing a .mof file). The folder can be cached from the salt master using the source option.
• path (str) -- Local path to the directory that contains the .mof configuration file to apply. Required.
• source (str) -- Path to the directory that contains the .mof file on the file_roots. The source directory will be copied to the path directory and then executed. If the path and source directories differ, the source directory will be applied. If source is not passed, the config located at path will be applied. Optional.
• salt_env (str) -- The salt environment to use when copying your source.  Default is 'base'
To apply a config that already exists on the system
salt '*' dsc.apply_config C:\\DSC\\WebSiteConfiguration
To cache a configuration from the master and apply it:
salt '*' dsc.apply_config C:\\DSC\\WebSiteConfiguration salt://dsc/configs/WebSiteConfiguration
salt.modules.win_dsc.compile_config(path, source=None, config_name=None, config_data=None, config_data_source=None, script_parameters=None, salt_env='base') Compile a config from a PowerShell script (.ps1)
• path (str) -- Path (local) to the script that will create the .mof configuration file. If no source is passed, the file must exist locally. Required.
• source (str) -- Path to the script on file_roots to cache at the location specified by path. The source file will be cached locally and then executed. If source is not passed, the config script located at path will be compiled. Optional.
• config_name (str) -- The name of the Configuration within the script to apply. If the script contains multiple configurations within the file a config_name must be specified. If the config_name is not specified, the name of the file will be used as the config_name to run. Optional.
• config_data (str) --
Configuration data in the form of a hash table that will be passed to the ConfigurationData parameter when the config_name is compiled. This can be the path to a .psd1 file containing the proper hash table or the PowerShell code to create the hash table.
• config_data_source (str) --
The path to the .psd1 file on file_roots to cache at the location specified by config_data. If this is specified, config_data must be a local path instead of a hash table.
• script_parameters (str) --
Any additional parameters expected by the configuration script. These must be defined in the script itself.
• salt_env (str) -- The salt environment to use when copying the source.  Default is 'base'
Returns A dictionary containing the results of the compilation
To compile a config from a script that already exists on the system:
salt '*' dsc.compile_config C:\\DSC\\WebsiteConfig.ps1
To cache a config script to the system from the master and compile it:
salt '*' dsc.compile_config C:\\DSC\\WebsiteConfig.ps1 salt://dsc/configs/WebsiteConfig.ps1
salt.modules.win_dsc.get_config() Get the current DSC Configuration
Returns A dictionary representing the DSC Configuration on the machine
Raises CommandExecutionError -- On failure
salt '*' dsc.get_config
salt.modules.win_dsc.get_config_status() Get the status of the current DSC Configuration
A dictionary representing the status of the current DSC Configuration on the machine
salt '*' dsc.get_config_status
salt.modules.win_dsc.get_lcm_config() Get the current Local Configuration Manager settings
A dictionary representing the Local Configuration Manager settings on the machine
salt '*' dsc.get_lcm_config
salt.modules.win_dsc.remove_config(reset=False) Remove the current DSC Configuration. Removes current, pending, and previous dsc configurations.
New in version 2017.7.5.
Parameters reset (bool) --
Attempts to reset the DSC configuration by removing the following from C:\Windows\System32\Configuration:
• File: DSCStatusHistory.mof
• File: DSCEngineCache.mof
• Dir: ConfigurationStatus
Default is False
WARNING: remove_config may fail to reset the DSC environment if any of the files in the ConfigurationStatus directory. If you wait a few minutes and run again, it may complete successfully.
salt '*' dsc.remove_config True
salt.modules.win_dsc.restore_config() Reapplies the previous configuration.
NOTE: The current configuration will be come the previous configuration. If run a second time back-to-back it is like toggling between two configs.
Returns True if successfully restored
salt '*' dsc.restore_config
salt.modules.win_dsc.run_config(path, source=None, config_name=None, config_data=None, config_data_source=None, script_parameters=None, salt_env='base') Compile a DSC Configuration in the form of a PowerShell script (.ps1) and apply it. The PowerShell script can be cached from the master using the source option. If there is more than one config within the PowerShell script, the desired configuration can be applied by passing the name in the config option.
This command would be the equivalent of running dsc.compile_config followed by dsc.apply_config.
• path (str) -- The local path to the PowerShell script that contains the DSC Configuration. Required.
• source (str) -- The path to the script on file_roots to cache at the location specified by path. The source file will be cached locally and then executed. If source is not passed, the config script located at path will be compiled. Optional.
Returns True if successfully compiled and applied, otherwise False
salt '*' dsc.run_config C:\\DSC\\WebsiteConfig.ps1
salt '*' dsc.run_config C:\\DSC\\WebsiteConfig.ps1 salt://dsc/configs/WebsiteConfig.ps1
salt.modules.win_dsc.set_lcm_config(config_mode=None, config_mode_freq=None, refresh_freq=None, reboot_if_needed=None, action_after_reboot=None, refresh_mode=None, certificate_id=None, configuration_id=None, allow_module_overwrite=None, debug_mode=False, status_retention_days=None) For detailed descriptions of the parameters see: https://msdn.microsoft.com/en-us/PowerShell/DSC/metaConfig
config_mode (str): How the LCM applies the configuration. Valid values are:
• ApplyOnly
• ApplyAndMonitor
• ApplyAndAutoCorrect
config_mode_freq (int): How often, in minutes, the current configuration is checked and applied. Ignored if config_mode is set to ApplyOnly.  Default is 15.
refresh_mode (str): How the LCM gets configurations. Valid values are:
• Disabled
• Push
• Pull
refresh_freq (int): How often, in minutes, the LCM checks for updated configurations. (pull mode only) Default is 30.
reboot_if_needed (bool): Reboot the machine if needed after a configuration is applied. Default is False.
action_after_reboot (str): Action to take after reboot. Valid values are:
• ContinueConfiguration
• StopConfiguration
certificate_id (guid): A GUID that specifies a certificate used to access the configuration: (pull mode)
configuration_id (guid): A GUID that identifies the config file to get from a pull server. (pull mode)
allow_module_overwrite (bool): New configs are allowed to overwrite old ones on the target node.
debug_mode (str): Sets the debug level. Valid values are:
• ForceModuleImport
status_retention_days (int): Number of days to keep status of the current config.
NOTE: Either config_mode_freq or refresh_freq needs to be a multiple of the other. See documentation on MSDN for more details.
salt '*' dsc.set_lcm_config ApplyOnly
salt.modules.win_dsc.test_config() Tests the current applied DSC Configuration
Returns True if successfully applied, otherwise False
salt '*' dsc.test_config
salt.modules.win_file Manage information about files on the minion, set/read user, group data, modify the ACL of files/directories
• win32api
• win32file
• win32con
• salt.utils.win_dacl
exception salt.modules.win_file.WindowsError
salt.modules.win_file.check_perms(path, ret=None, owner=None, grant_perms=None, deny_perms=None, inheritance=True, reset=False) Check owner and permissions for the passed directory. This function checks the permissions and sets them, returning the changes made. Used by the file state to populate the return dict
• path (str) -- The full path to the directory.
• ret (dict) -- A dictionary to append changes to and return. If not passed, will create a new dictionary to return.
• owner (str) -- The owner to set for the directory.
• grant_perms (dict) -- A dictionary containing the user/group and the basic permissions to check/grant, ie: {'user': {'perms': 'basic_permission'}}.  Default is None.
• deny_perms (dict) -- A dictionary containing the user/group and permissions to check/deny. Default is None.
• inheritance (bool) -- True will check if inheritance is enabled and enable it. ``False will check if inheritance is disabled and disable it. Default is True.
• reset (bool) -- True will show what permissions will be removed by resetting the DACL. False will do nothing. Default is False.
Returns A dictionary of changes that have been made
# To see changes to ``C:\Temp`` if the 'Users' group is given 'read & execute' permissions. salt '*' file.check_perms C:\Temp\ {} Administrators "{'Users': {'perms': 'read_execute'}}"
# Locally using salt call salt-call file.check_perms C:\Temp\ {} Administrators "{'Users': {'perms': 'read_execute', 'applies_to': 'this_folder_only'}}"
# Specify advanced attributes with a list salt '*' file.check_perms C:\Temp\ {} Administrators "{'jsnuffy': {'perms': ['read_attributes', 'read_ea'], 'applies_to': 'files_only'}}"
salt.modules.win_file.chgrp(path, group) Change the group of a file
Under Windows, this will do nothing.
While a file in Windows does have a 'primary group', this rarely used attribute generally has no bearing on permissions unless intentionally configured and is only used to support Unix compatibility features (e.g.  Services For Unix, NFS services).
Salt, therefore, remaps this function to do nothing while still being compatible with Unix behavior. When managing Windows systems, this function is superfluous and will generate an info level log entry if used directly.
If you do actually want to set the 'primary group' of a file, use file .chpgrp.
To set group permissions use file.set_perms
• path (str) -- The path to the file or directory
• group (str) -- The group (unused)
Returns None
salt '*' file.chpgrp c:\temp\test.txt administrators
salt.modules.win_file.chown(path, user, group=None, pgroup=None, follow_symlinks=True) Chown a file, pass the file the desired user and group
Under Windows, the group parameter will be ignored.
This is because while files in Windows do have a 'primary group' property, this is rarely used.  It generally has no bearing on permissions unless intentionally configured and is most commonly used to provide Unix compatibility (e.g. Services For Unix, NFS services).
If you do want to change the 'primary group' property and understand the implications, pass the Windows only parameter, pgroup, instead.
• user (str) -- The name of the user to own the file
• group (str) -- The group (not used)
• pgroup (str) -- The primary group to assign
• follow_symlinks (bool) -- If the object specified by path is a symlink, get attributes of the linked file instead of the symlink itself. Default is True
Returns True if successful, otherwise error
salt '*' file.chown c:\temp\test.txt myusername salt '*' file.chown c:\temp\test.txt myusername pgroup=Administrators salt '*' file.chown c:\temp\test.txt myusername "pgroup='None'"
salt.modules.win_file.chpgrp(path, group) Change the group of a file
Under Windows, this will set the rarely used primary group of a file.  This generally has no bearing on permissions unless intentionally configured and is most commonly used to provide Unix compatibility (e.g.  Services For Unix, NFS services).
Ensure you know what you are doing before using this function.
salt '*' file.chpgrp c:\temp\test.txt Administrators salt '*' file.chpgrp c:\temp\test.txt "'None'"
salt.modules.win_file.get_attributes(path) Return a dictionary object with the Windows file attributes for a file.
Parameters path (str) -- The path to the file or directory
Returns A dictionary of file attributes
salt '*' file.get_attributes c:\temp\a.txt
salt.modules.win_file.get_gid(path, follow_symlinks=True) Return the id of the group that owns a given file
Under Windows, this will return the uid of the file.
Salt, therefore, remaps this function to provide functionality that somewhat resembles Unix behavior for API compatibility reasons. When managing Windows systems, this function is superfluous and will generate an info level log entry if used directly.
If you do actually want to access the 'primary group' of a file, use file.get_pgid.
Returns The gid of the owner
salt '*' file.get_gid c:\temp\test.txt
salt.modules.win_file.get_group(path, follow_symlinks=True) Return the group that owns a given file
Under Windows, this will return the user (owner) of the file.
If you do actually want to access the 'primary group' of a file, use file.get_pgroup.
Returns The name of the owner
salt '*' file.get_group c:\temp\test.txt
salt.modules.win_file.get_mode(path) Return the mode of a file
Right now we're just returning None because Windows' doesn't have a mode like Linux
salt.modules.win_file.get_pgid(path, follow_symlinks=True) Return the id of the primary group that owns a given file (Windows only)
This function will return the rarely used primary group of a file. This generally has no bearing on permissions unless intentionally configured and is most commonly used to provide Unix compatibility (e.g. Services For Unix, NFS services).
Returns The gid of the primary group
salt '*' file.get_pgid c:\temp\test.txt
salt.modules.win_file.get_pgroup(path, follow_symlinks=True) Return the name of the primary group that owns a given file (Windows only)
The return value may be 'None', e.g. if the user is not on a domain. This is a valid group - do not confuse this with the Salt/Python value of None which means no value was returned. To be certain, use the get_pgid function which will return the SID, including for the system 'None' group.
Returns The name of the primary group
salt '*' file.get_pgroup c:\temp\test.txt
salt.modules.win_file.get_uid(path, follow_symlinks=True) Return the id of the user that owns a given file
Symlinks are followed by default to mimic Unix behavior. Specify follow_symlinks=False to turn off this behavior.
Returns The uid of the owner
salt '*' file.get_uid c:\temp\test.txt salt '*' file.get_uid c:\temp\test.txt follow_symlinks=False
salt.modules.win_file.get_user(path, follow_symlinks=True) Return the user that owns a given file
salt '*' file.get_user c:\temp\test.txt salt '*' file.get_user c:\temp\test.txt follow_symlinks=False
salt.modules.win_file.gid_to_group(gid) Convert the group id to the group name on this system
Under Windows, because groups are just another ACL entity, this function behaves the same as uid_to_user.
For maintaining Windows systems, this function is superfluous and only exists for API compatibility with Unix. Use the uid_to_user function instead; an info level log entry will be generated if this function is used directly.
Parameters gid (str) -- The gid of the group
Returns The name of the group
salt '*' file.gid_to_group S-1-5-21-626487655-2533044672-482107328-1010
salt.modules.win_file.group_to_gid(group) Convert the group to the gid on this system
Under Windows, because groups are just another ACL entity, this function behaves the same as user_to_uid, except if None is given, '' is returned.
For maintaining Windows systems, this function is superfluous and only exists for API compatibility with Unix. Use the user_to_uid function instead; an info level log entry will be generated if this function is used directly.
Parameters group (str) -- The name of the group
Returns The gid of the group
salt '*' file.group_to_gid administrators
salt.modules.win_file.is_link(path) Check if the path is a symlink
This is only supported on Windows Vista or later.
Inline with Unix behavior, this function will raise an error if the path is not a symlink, however, the error raised will be a SaltInvocationError, not an OSError.
Parameters path (str) -- The path to a file or directory
Returns True if path is a symlink, otherwise False
salt.modules.win_file.lchown(path, user, group=None, pgroup=None) Chown a file, pass the file the desired user and group without following any symlinks.
To set the primary group to 'None', it must be specified in quotes.  Otherwise Salt will interpret it as the Python value of None and no primary group changes will occur. See the example below.
salt '*' file.lchown c:\temp\test.txt myusername salt '*' file.lchown c:\temp\test.txt myusername pgroup=Administrators salt '*' file.lchown c:\temp\test.txt myusername "pgroup='None'"
salt.modules.win_file.makedirs_(path, owner=None, grant_perms=None, deny_perms=None, inheritance=True, reset=False) Ensure that the parent directory containing this path is available.
• path (str) --
The full path to the directory.
NOTE: The path must end with a trailing slash otherwise the directory(s) will be created up to the parent directory. For example if path is C:\temp\test, then it would be treated as C:\temp\ but if the path ends with a trailing slash like C:\temp\test\, then it would be treated as C:\temp\test\.
• owner (str) -- The owner of the directory. If not passed, it will be the account that created the directory, likely SYSTEM.
• grant_perms (dict) --
A dictionary containing the user/group and the basic permissions to grant, ie: {'user': {'perms': 'basic_permission'}}. You can also set the applies_to setting here. The default is this_folder_subfolders_files. Specify another applies_to setting like this:
{'user': {'perms': 'full_control', 'applies_to': 'this_folder'}}
To set advanced permissions use a list for the perms parameter, ie:
{'user': {'perms': ['read_attributes', 'read_ea'], 'applies_to': 'this_folder'}}
• deny_perms (dict) -- A dictionary containing the user/group and permissions to deny along with the applies_to setting. Use the same format used for the grant_perms parameter. Remember, deny permissions supersede grant permissions.
• inheritance (bool) -- If True the object will inherit permissions from the parent, if False, inheritance will be disabled. Inheritance setting will not apply to parent directories if they must be created.
• reset (bool) --
If True the existing DACL will be cleared and replaced with the settings defined in this function. If False, new entries will be appended to the existing DACL. Default is False.
Raises CommandExecutionError -- If unsuccessful
# To grant the 'Users' group 'read & execute' permissions. salt '*' file.makedirs C:\Temp\ Administrators "{'Users': {'perms': 'read_execute'}}"
# Locally using salt call salt-call file.makedirs C:\Temp\ Administrators "{'Users': {'perms': 'read_execute', 'applies_to': 'this_folder_only'}}"
# Specify advanced attributes with a list salt '*' file.makedirs C:\Temp\ Administrators "{'jsnuffy': {'perms': ['read_attributes', 'read_ea'], 'applies_to': 'this_folder_only'}}"
salt.modules.win_file.makedirs_perms(path, owner=None, grant_perms=None, deny_perms=None, inheritance=True, reset=True) Set owner and permissions for each directory created.
• inheritance (bool) -- If True the object will inherit permissions from the parent, if False, inheritance will be disabled. Inheritance setting will not apply to parent directories if they must be created
Returns True if successful, otherwise raises an error
# To grant the 'Users' group 'read & execute' permissions. salt '*' file.makedirs_perms C:\Temp\ Administrators "{'Users': {'perms': 'read_execute'}}"
# Locally using salt call salt-call file.makedirs_perms C:\Temp\ Administrators "{'Users': {'perms': 'read_execute', 'applies_to': 'this_folder_only'}}"
# Specify advanced attributes with a list salt '*' file.makedirs_perms C:\Temp\ Administrators "{'jsnuffy': {'perms': ['read_attributes', 'read_ea'], 'applies_to': 'this_folder_files'}}"
salt.modules.win_file.mkdir(path, owner=None, grant_perms=None, deny_perms=None, inheritance=True, reset=False) Ensure that the directory is available and permissions are set.
• owner (str) -- The owner of the directory. If not passed, it will be the account that created the directory, likely SYSTEM
# To grant the 'Users' group 'read & execute' permissions. salt '*' file.mkdir C:\Temp\ Administrators "{'Users': {'perms': 'read_execute'}}"
# Locally using salt call salt-call file.mkdir C:\Temp\ Administrators "{'Users': {'perms': 'read_execute', 'applies_to': 'this_folder_only'}}"
# Specify advanced attributes with a list salt '*' file.mkdir C:\Temp\ Administrators "{'jsnuffy': {'perms': ['read_attributes', 'read_ea'], 'applies_to': 'this_folder_only'}}"
salt.modules.win_file.readlink(path) Return the path that a symlink points to
Parameters path (str) -- The path to the symlink
Returns The path that the symlink points to
salt.modules.win_file.remove(path, force=False) Remove the named file or directory
• path (str) -- The path to the file or directory to remove.
• force (bool) -- Remove even if marked Read-Only. Default is False
Returns True if successful, False if unsuccessful
salt '*' file.remove C:\Temp
salt.modules.win_file.set_attributes(path, archive=None, hidden=None, normal=None, notIndexed=None, readonly=None, system=None, temporary=None) Set file attributes for a file.  Note that the normal attribute means that all others are false.  So setting it will clear all others.
• archive (bool) -- Sets the archive attribute. Default is None
• hidden (bool) -- Sets the hidden attribute. Default is None
• normal (bool) -- Resets the file attributes. Cannot be used in conjunction with any other attribute. Default is None
• notIndexed (bool) -- Sets the indexed attribute. Default is None
• readonly (bool) -- Sets the readonly attribute. Default is None
• system (bool) -- Sets the system attribute. Default is None
• temporary (bool) -- Sets the temporary attribute. Default is None
salt '*' file.set_attributes c:\temp\a.txt normal=True salt '*' file.set_attributes c:\temp\a.txt readonly=True hidden=True
salt.modules.win_file.set_mode(path, mode) Set the mode of a file
This just calls get_mode, which returns None because we don't use mode on Windows
• path -- The path to the file or directory
• mode -- The mode (not used)
salt.modules.win_file.set_perms(path, grant_perms=None, deny_perms=None, inheritance=True, reset=False) Set permissions for the given path
A dictionary containing the user/group and the basic permissions to grant, ie: {'user': {'perms': 'basic_permission'}}. You can also set the applies_to setting here. The default for applise_to is this_folder_subfolders_files. Specify another applies_to setting like this:
To see a list of available attributes and applies to settings see the documentation for salt.utils.win_dacl.
A value of None will make no changes to the grant portion of the DACL. Default is None.
• deny_perms (dict) --
A dictionary containing the user/group and permissions to deny along with the applies_to setting. Use the same format used for the grant_perms parameter. Remember, deny permissions supersede grant permissions.
A value of None will make no changes to the deny portion of the DACL. Default is None.
• inheritance (bool) -- If True the object will inherit permissions from the parent, if False, inheritance will be disabled. Inheritance setting will not apply to parent directories if they must be created. Default is False.
If True the existing DCL will be cleared and replaced with the settings defined in this function. If False, new entries will be appended to the existing DACL. Default is False.
# To grant the 'Users' group 'read & execute' permissions. salt '*' file.set_perms C:\Temp\ "{'Users': {'perms': 'read_execute'}}"
# Locally using salt call salt-call file.set_perms C:\Temp\ "{'Users': {'perms': 'read_execute', 'applies_to': 'this_folder_only'}}"
# Specify advanced attributes with a list salt '*' file.set_perms C:\Temp\ "{'jsnuffy': {'perms': ['read_attributes', 'read_ea'], 'applies_to': 'this_folder_only'}}"
salt.modules.win_file.stats(path, hash_type='sha256', follow_symlinks=True) Return a dict containing the stats about a given file
Under Windows, gid will equal uid and group will equal user.
Salt, therefore, remaps these properties to keep some kind of compatibility with Unix behavior. If the 'primary group' is required, it can be accessed in the pgroup and pgid properties.
• hash_type (str) -- The type of hash to return
Returns A dictionary of file/directory stats
salt.modules.win_file.symlink(src, link) Create a symbolic link to a file
This is only supported with Windows Vista or later and must be executed by a user with the SeCreateSymbolicLink privilege.
The behavior of this function matches the Unix equivalent, with one exception - invalid symlinks cannot be created. The source path must exist.  If it doesn't, an error will be raised.
• src (str) -- The path to a file or directory
• link (str) -- The path to the link
salt.modules.win_file.uid_to_user(uid) Convert a uid to a user name
Parameters uid (str) -- The user id to lookup
Returns The name of the user
salt '*' file.uid_to_user S-1-5-21-626487655-2533044672-482107328-1010
salt.modules.win_file.user_to_uid(user) Convert user name to a uid
Parameters user (str) -- The user to lookup
Returns The user id of the user
salt '*' file.user_to_uid myusername
salt.modules.win_firewall Module for configuring Windows Firewall using netsh
salt.modules.win_firewall.add_rule(name, localport, protocol='tcp', action='allow', dir='in', remoteip='any') New in version 2015.5.0.
Add a new inbound or outbound rule to the firewall policy
• name (str) -- The name of the rule. Must be unique and cannot be "all".  Required.
• localport (int) -- The port the rule applies to. Must be a number between 0 and 65535. Can be a range. Can specify multiple ports separated by commas. Required.
• protocol (Optional[str]) --
The protocol. Can be any of the following:
• A number between 0 and 255
• icmpv4
• icmpv6
• tcp
• udp
• any
• action (Optional[str]) --
The action the rule performs. Can be any of the following:
• allow
• block
• bypass
• dir (Optional[str]) -- The direction. Can be in or out.
• remoteip (Optional [str]) --
The remote IP. Can be any of the following:
• localsubnet
• dns
• dhcp
• wins
• defaultgateway
• Any valid IPv4 address (192.168.0.12)
• Any valid IPv6 address (2002:9b3b:1a31:4:208:74ff:fe39:6c43)
• Any valid subnet (192.168.1.0/24)
• Any valid range of IP addresses (192.168.0.1-192.168.0.12)
• A list of valid IP addresses
Can be combinations of the above separated by commas.
Raises CommandExecutionError -- If the command fails
salt '*' firewall.add_rule 'test' '8080' 'tcp' salt '*' firewall.add_rule 'test' '1' 'icmpv4' salt '*' firewall.add_rule 'test_remote_ip' '8000' 'tcp' 'allow' 'in' '192.168.0.1'
salt.modules.win_firewall.delete_rule(name=None, localport=None, protocol=None, dir=None, remoteip=None) New in version 2015.8.0.
Delete an existing firewall rule identified by name and optionally by ports, protocols, direction, and remote IP.
• name (str) -- The name of the rule to delete. If the name all is used you must specify additional parameters.
• localport (Optional[str]) -- The port of the rule. If protocol is not specified, protocol will be set to tcp
• protocol (Optional[str]) -- The protocol of the rule. Default is tcp when localport is specified
• dir (Optional[str]) -- The direction of the rule.
• remoteip (Optional[str]) -- The remote IP of the rule.
# Delete incoming tcp port 8080 in the rule named 'test' salt '*' firewall.delete_rule 'test' '8080' 'tcp' 'in'
# Delete the incoming tcp port 8000 from 192.168.0.1 in the rule named # 'test_remote_ip' salt '*' firewall.delete_rule 'test_remote_ip' '8000' 'tcp' 'in' '192.168.0.1'
# Delete all rules for local port 80: salt '*' firewall.delete_rule all 80 tcp
# Delete a rule called 'allow80': salt '*' firewall.delete_rule allow80
salt.modules.win_firewall.disable(profile='allprofiles') Disable firewall profile
Parameters profile (Optional[str]) --
The name of the profile to disable. Default is allprofiles. Valid options are:
• allprofiles
• domainprofile
• privateprofile
• publicprofile
salt '*' firewall.disable
salt.modules.win_firewall.enable(profile='allprofiles') New in version 2015.5.0.
Enable firewall profile
The name of the profile to enable. Default is allprofiles. Valid options are:
salt '*' firewall.enable
salt.modules.win_firewall.get_all_profiles(store='local') Gets all properties for all profiles in the specified store
Parameters store (str) --
The store to use. This is either the local firewall policy or the policy defined by local group policy. Valid options are:
• lgpo
Default is local
Returns A dictionary containing the specified settings for each profile
# Get all firewall settings for all profiles salt * firewall.get_all_settings
# Get all firewall settings for all profiles as defined by local group # policy
salt * firewall.get_all_settings lgpo
salt.modules.win_firewall.get_all_settings(domain, store='local') Gets all the properties for the specified profile in the specified store
• profile (str) --
The firewall profile to query. Valid options are:
• domain
• store (str) --
Returns A dictionary containing the specified settings
# Get all firewall settings for connections on the domain profile salt * win_firewall.get_all_settings domain
# Get all firewall settings for connections on the domain profile as # defined by local group policy salt * win_firewall.get_all_settings domain lgpo
salt.modules.win_firewall.get_config() Get the status of all the firewall profiles
Returns A dictionary of all profiles on the system
salt '*' firewall.get_config
salt.modules.win_firewall.get_rule(name='all') New in version 2015.5.0.
Display all matching rules as specified by name
Parameters name (Optional[str]) -- The full name of the rule. all will return all rules. Default is all
Returns A dictionary of all rules or rules that match the name exactly
salt '*' firewall.get_rule 'MyAppPort'
salt.modules.win_firewall.get_settings(profile, section, store='local') Get the firewall property from the specified profile in the specified store as returned by netsh advfirewall.
• section (str) --
The property to query within the selected profile. Valid options are:
• firewallpolicy : inbound/outbound behavior
• logging : firewall logging settings
• settings : firewall properties
• state : firewalls state (on | off)
Returns A dictionary containing the properties for the specified profile
• CommandExecutionError -- If an error occurs
• ValueError -- If the parameters are incorrect
# Get the inbound/outbound firewall settings for connections on the # local domain profile salt * win_firewall.get_settings domain firewallpolicy
# Get the inbound/outbound firewall settings for connections on the # domain profile as defined by local group policy salt * win_firewall.get_settings domain firewallpolicy lgpo
salt.modules.win_firewall.rule_exists(name) New in version 2016.11.6.
Checks if a firewall rule exists in the firewall policy
Parameters name (str) -- The name of the rule
# Is there a rule named RemoteDesktop salt '*' firewall.rule_exists RemoteDesktop
salt.modules.win_firewall.set_firewall_settings(profile, inbound=None, outbound=None, store='local') Set the firewall inbound/outbound settings for the specified profile and store
• inbound (str) --
The inbound setting. If None is passed, the setting will remain unchanged. Valid values are:
• blockinbound
• blockinboundalways
• allowinbound
• notconfigured
Default is None
• outbound (str) --
The outbound setting. If None is passed, the setting will remain unchanged. Valid values are:
• allowoutbound
• blockoutbound
# Set the inbound setting for the domain profile to block inbound # connections salt * firewall.set_firewall_settings domain='domain' inbound='blockinbound'
# Set the outbound setting for the domain profile to allow outbound # connections salt * firewall.set_firewall_settings domain='domain' outbound='allowoutbound'
# Set inbound/outbound settings for the domain profile in the group # policy to block inbound and allow outbound salt * firewall.set_firewall_settings domain='domain' inbound='blockinbound' outbound='allowoutbound' store='lgpo'
salt.modules.win_firewall.set_logging_settings(profile, setting, value, store='local') Configure logging settings for the Windows firewall.
The firewall profile to configure. Valid options are:
• setting (str) --
The logging setting to configure. Valid options are:
• allowedconnections
• droppedconnections
• filename
• maxfilesize
The value to apply to the setting. Valid values are dependent upon the setting being configured. Valid options are:
allowedconnections:
• enable
• disable
droppedconnections:
filename:
• Full path and name of the firewall log file
maxfilesize:
• 1 - 32767
NOTE: notconfigured can only be used when using the lgpo store
# Log allowed connections and set that in local group policy salt * firewall.set_logging_settings domain allowedconnections enable lgpo
# Don't log dropped connections salt * firewall.set_logging_settings profile=private setting=droppedconnections value=disable
# Set the location of the log file salt * firewall.set_logging_settings domain filename C:\windows\logs\firewall.log
# You can also use environment variables salt * firewall.set_logging_settings domain filename %systemroot%\system32\LogFiles\Firewall\pfirewall.log
# Set the max file size of the log to 2048 Kb salt * firewall.set_logging_settings domain maxfilesize 2048
salt.modules.win_firewall.set_settings(profile, setting, value, store='local') Configure firewall settings.
The firewall setting to configure. Valid options are:
• localfirewallrules
• localconsecrules
• inboundusernotification
• remotemanagement
• unicastresponsetomulticast
The value to apply to the setting. Valid options are
# Merge local rules with those distributed through group policy salt * firewall.set_settings domain localfirewallrules enable
# Allow remote management of Windows Firewall salt * firewall.set_settings domain remotemanagement enable
salt.modules.win_firewall.set_state(profile, state, store='local') Configure the firewall state.
• state (str) --
The firewall state. Valid options are:
• on
• off
# Turn the firewall off when the domain profile is active salt * firewall.set_state domain off
# Turn the firewall on when the public profile is active and set that in # the local group policy salt * firewall.set_state public on lgpo
salt.modules.win_groupadd Manage groups on Windows
salt.modules.win_groupadd.add(name, **kwargs) Add the specified group
Parameters name (str) -- The name of the group to add
salt '*' group.add foo
salt.modules.win_groupadd.adduser(name, username, **kwargs) Add a user to a group
• name (str) -- The name of the group to modify
• username (str) -- The name of the user to add to the group
salt '*' group.adduser foo username
salt.modules.win_groupadd.delete(name, **kwargs) Remove the named group
Parameters name (str) -- The name of the group to remove
salt.modules.win_groupadd.deluser(name, username, **kwargs) Remove a user from a group
• username (str) -- The name of the user to remove from the group
salt '*' group.deluser foo username
salt.modules.win_groupadd.getent(refresh=False) Return info on all groups
Parameters refresh (bool) -- Refresh the info for all groups in __context__. If False only the groups in __context__ will be returned. If True the __context__ will be refreshed with current data and returned.  Default is False
Returns A list of groups and their information
salt.modules.win_groupadd.info(name) Return information about a group
Parameters name (str) -- The name of the group for which to get information
Returns A dictionary of information about the group
salt.modules.win_groupadd.list_groups(refresh=False) Return a list of groups
Parameters refresh (bool) -- Refresh the info for all groups in __context__. If False only the groups in __context__ will be returned. If True, the __context__ will be refreshed with current data and returned.  Default is False
Returns A list of groups on the machine
salt '*' group.list_groups
salt.modules.win_groupadd.members(name, members_list, **kwargs) Ensure a group contains only the members in the list
• members_list (str) -- A single user or a comma separated list of users. The group will contain only the users specified in this list.
salt '*' group.members foo 'user1,user2,user3'
salt.modules.win_iis Microsoft IIS site management via WebAdministration powershell module
maintainer Shane Lee <slee@saltstack.com>, Robert Booth <‐ rbooth@saltstack.com>
platform Windows
depends PowerShell
depends WebAdministration module (PowerShell) (IIS)
salt.modules.win_iis.create_app(name, site, sourcepath, apppool=None) 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.
• 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.
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.
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.
Parameters name (str) -- The name of the IIS application pool.
salt '*' win_iis.create_apppool name='MyTestPool'
salt.modules.win_iis.create_backup(name) Backup an IIS Configuration on the System.
NOTE: Backups are stored in the $env:Windir\System32\inetsrv\backup folder.
Parameters name (str) -- The name to give the backup
salt '*' win_iis.create_backup good_config_20170209