Method: Puppet::Util::Windows::Security#set_owner

Defined in:
lib/puppet/util/windows/security.rb

#set_owner(owner_sid, path) ⇒ Object

Set the owner of the object referenced by path to the specified owner_sid. The owner sid should be of the form “S-1-5-32-544” and can either be a user or group. Only a user with the SE_RESTORE_NAME privilege in their process token can overwrite the object’s owner to something other than the current user.



119
120
121
122
123
124
125
126
# File 'lib/puppet/util/windows/security.rb', line 119

def set_owner(owner_sid, path)
  sd = get_security_descriptor(path)

  if owner_sid != sd.owner
    sd.owner = owner_sid
    set_security_descriptor(path, sd)
  end
end