Setting folder permissions with powershell -
i'm trying change folders owner using get-acl , set-acl. issues lies when try change get-acl object using .setowner() correct way change objects owner property? using ps 2.0.
$domainnameshort = "domain" $profilename = "user_name" $newprofilelocation = "\\server\folder" $objuser = new-object system.security.principal.ntaccount("$domainnameshort\$profilename") $objfile = get-acl $newprofilelocation $objfile.setowner($objuser) set-acl -aclobject $objfile -path $newprofilelocation this error getting:
exception calling "setowner" "1" argument(s): "some or identity references not translated ." @ line:6 char:18 + $objfile.setowner <<<< ($objuser) + categoryinfo : notspecified: (:) [], methodinvocationexception + fullyqualifiederrorid : dotnetmethodexception any guidance appreciated, thanks.
your domain or username incorrect.
setowner() can verify identity provided $objuser
caution aware using set-acl on share (not folder beneath share, root/share itself) can break inheritance of permissions.
Comments
Post a Comment