#! perl -sw use strict; use Win32::Perms; my %ACE_masks = ( FULL => FULL, # Full access (RWDXOP) ALL => ALL, # Same as FULL CHANGE => CHANGE, # Change access (RWDX) READ => READ, # Read access WRITE => WRITE, # Write access DELETE => DELETE, # Delete access EXECUTE => EXECUTE, # Execute access NO_ACCESS => NO_ACCESS, # No permissions specified ); my %ACE_types = ( ALLOW => ALLOW, # The permission mask is allowed GRANT => GRANT, # Same as ALLOW DENY => DENY, # Permission mask is denied AUDIT => AUDIT, # The permission mask is for auditing OWNER => OWNER, # The account specified is the OWNER (the permission mask is ignored) GROUP => GROUP, # The account specified is the GROUP (the permission mask is ignored) ); my %ACE_flags = ( DIRECTORY => DIRECTORY, # The permission is for a directory DIR => DIR, # Same as DIRECTORY KEY => KEY, # the permission is for a Registry key CONTAINER => CONTAINER, # The permission is for a container object (dir, Registry key, etc) FILE => FILE, # The permission is for a file NON_CONTAINER => NON_CONTAINER, # The permission is for a non container object (file, etc) SUCCESS => SUCCESS, # If the type is AUDIT then this will log a successful audit FAILURE => FAILURE, # If the type is AUDIT then this will log a failed audit ); #### ... $perms->Add('MYDOMAIN\bloggJo', $ACE_masks{$ARGV[1]}|$ACE_masks{$ARGV[2]} ACCESS_ALLOWED_ACE_TYPE, OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE);