salt.modules.win_file

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

depends:
  • win32api
  • win32con
  • 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_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 777 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.stats(path, hash_type='md5', follow_symlink=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