Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - a set-acl (change owner) problem

Reply
 
Old 03-15-2007   #1 (permalink)
Doker


 
 

a set-acl (change owner) problem

Hi guys.

I'm trying to set-up a virtual web folder and to do it I firstly
create it then (trying to) set owner to the user i create it for and
finally mark it a virtual web directory.

Here how it goes:
write-host -n "nazwa konta:"
$username = Read-Host
if( $username.trim() -eq "")
{ break; }


### tworzymy strone

$homedir = (ls env:homedrive).value + "\Documents and Settings\" +
$username + "\My Documents\"
$wwwdir = $homedir + "public_www"
mkdir $wwwdir


$account = new-object system.security.principal.ntaccount("CHESLAV\" +
$username)
$acl = get-acl -path "$wwwdir"

$acl.setowner($account)
set-acl -path "$wwwdir" -aclObject $acl #### here i get the error
cacls "$wwwdir" /E /G IUSR_CHESLAV:R > $null

iisvdir /create "Uzytkownicy" "$username" "$wwwdir"


Unfortunately, get the error saying:
Set-Acl : The security identifier is not allowed to be the owner of
this object.
At line:1 char:8
+ set-acl <<<< -path "$wwwdir" -aclObject $acl

and if I try to use xxx instead i receive the following:
PS C:\root> $dirobj.setaccesscontrol($acl)
Exception calling "SetAccessControl" with "1" argument(s): "The
security identifier is not allowed to be the owner of t
his object."
At line:1 char:25
+ $dirobj.setaccesscontrol( <<<< $acl)
(where $dirobj is retrived using get-item $wwwdir in this case)

What's worth a notice, when $account is acquired frome
"Administrator", all goes well.

Any help?


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
How to change a file's owner? Vista file management
How do I change the owner in C:/user/owner General Discussion
Change all references held by previous owner/administrator to new owner System Security
Change administrator owner Vista account administration
Change Registered Owner Name Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46