salt.modules.win_file

Manage information about files on the minion, set/read user, group data

depends:
  • win32api
  • win32con
  • win32file
  • win32security
  • ntsecuritycon
salt.modules.win_file.chgrp(path, group)

Change the group of a file

CLI Example:

salt '*' file.chgrp c:\temp\test.txt administrators
salt.modules.win_file.chown(path, user, group)

Chown a file, pass the file the desired user and group

CLI Example:

salt '*' file.chown c:\temp\test.txt myusername administrators
salt.modules.win_file.get_attributes(path)

Return a dictionary object with the Windows file attributes for a file.

CLI Example:

salt '*' file.get_attributes c:\temp\a.txt
salt.modules.win_file.get_gid(path)

Return the id of the group that owns a given file

CLI Example:

salt '*' file.get_gid c:\temp\test.txt
salt.modules.win_file.get_group(path)

Return the group that owns a given file

CLI Example:

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

CLI Example:

salt '*' file.get_mode /etc/passwd
salt.modules.win_file.get_uid(path)

Return the id of the user that owns a given file

CLI Example:

salt '*' file.get_uid c:\temp\test.txt
salt.modules.win_file.get_user(path)

Return the user that owns a given file

CLI Example:

salt '*' file.get_user c:\temp\test.txt
salt.modules.win_file.gid_to_group(gid)

Convert the group id to the group name on this system

CLI Example:

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

CLI Example:

salt '*' file.group_to_gid administrators
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.

CLI Example:

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

CLI Example:

salt '*' file.set_mode /etc/passwd 0644
salt.modules.win_file.stats(path, hash_type='md5', follow_symlinks=False)

Return a dict containing the stats for a given file

CLI Example:

salt '*' file.stats /etc/passwd
salt.modules.win_file.uid_to_user(uid)

Convert a uid to a user name

CLI Example:

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

CLI Example:

salt '*' file.user_to_uid myusername

Current Salt release: 2014.1.6

Docs for previous releases on salt.rtfd.org.

Previous topic

salt.modules.win_dns_client

Next topic

salt.modules.win_firewall

Upcoming SaltStack Events