Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Problem with SetOwner in windows PowerShell

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 12-17-2007   #1 (permalink)
Adrian
Guest


 

Problem with SetOwner in windows PowerShell

Hi,

I'm looking for a solution. I'm trying to change the owner of a directory. I've no permission and I'm not the owner of the directory. I get the following error: "Get-Acl: Attempted to perform an unauthorized operation". Here is my PowerShell-script:

$AclFolder = Get-Acl -path $Folder // Error: Get-Act: Attempted to perform an unauthorized operation.
$Users = New-Object System.Security.Principal.NTAccount($DomainAdmins)
$AclFolder.SetOwner($Users)
Set-Acl -path $Folder -aclObject $AclFolder

I'm running the PowerShell-script as a Domain Administrator. If I use the Windows-GUI, I can change the owner without a problem (incl. subcontainers and objects). Do you know a solution for my problem?

Thank you,
Adrian



EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com

My System SpecsSystem Spec
Old 12-17-2007   #2 (permalink)
Shay Levi
Guest


 

Re: Problem with SetOwner in windows PowerShell


Are you logged in to windows with a user that has sufficient privileges (admin
rights) prior to launching PowerShell?


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic


Quote:

> Hi,
>
> I'm looking for a solution. I'm trying to change the owner of a
> directory. I've no permission and I'm not the owner of the directory.
> I get the following error: "Get-Acl: Attempted to perform an
> unauthorized operation". Here is my PowerShell-script:
>
> $AclFolder = Get-Acl -path $Folder // Error: Get-Act: Attempted to
> perform an unauthorized operation.
>
> $Users = New-Object System.Security.Principal.NTAccount($DomainAdmins)
>
> $AclFolder.SetOwner($Users)
>
> Set-Acl -path $Folder -aclObject $AclFolder
>
> I'm running the PowerShell-script as a Domain Administrator. If I use
> the Windows-GUI, I can change the owner without a problem (incl.
> subcontainers and objects). Do you know a solution for my problem?
>
> Thank you,
> Adrian
> EggHeadCafe - .NET Developer Portal of Choice
> http://www.eggheadcafe.com
>

My System SpecsSystem Spec
Old 12-17-2007   #3 (permalink)
Marco Shaw [MVP]
Guest


 

Re: Problem with SetOwner in windows PowerShell

Adrian wrote:
Quote:

> Hi,
>
> I'm looking for a solution. I'm trying to change the owner of a directory. I've no permission and I'm not the owner of the directory. I get the following error: "Get-Acl: Attempted to perform an unauthorized operation". Here is my PowerShell-script:
>
> $AclFolder = Get-Acl -path $Folder // Error: Get-Act: Attempted to perform an unauthorized operation.
> $Users = New-Object System.Security.Principal.NTAccount($DomainAdmins)
> $AclFolder.SetOwner($Users)
> Set-Acl -path $Folder -aclObject $AclFolder
>
> I'm running the PowerShell-script as a Domain Administrator. If I use the Windows-GUI, I can change the owner without a problem (incl. subcontainers and objects). Do you know a solution for my problem?
OK, it would seem like you have the proper permissions. What OS?

Like Shay mentions though, if Vista, how are you starting PowerShell?

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 12-17-2007   #4 (permalink)
/\/\o\/\/ [MVP]
Guest


 

Re: Problem with SetOwner in windows PowerShell

Oisin,did make a set-owner Cmdlet for this,
also you can use the PowerShell COmmunity extensions privileges cmdlets to
fix this.

Greetings /\/\o\/\/


"Marco Shaw [MVP]" wrote:
Quote:

> Adrian wrote:
Quote:

> > Hi,
> >
> > I'm looking for a solution. I'm trying to change the owner of a directory. I've no permission and I'm not the owner of the directory. I get the following error: "Get-Acl: Attempted to perform an unauthorized operation". Here is my PowerShell-script:
> >
> > $AclFolder = Get-Acl -path $Folder // Error: Get-Act: Attempted to perform an unauthorized operation.
> > $Users = New-Object System.Security.Principal.NTAccount($DomainAdmins)
> > $AclFolder.SetOwner($Users)
> > Set-Acl -path $Folder -aclObject $AclFolder
> >
> > I'm running the PowerShell-script as a Domain Administrator. If I use the Windows-GUI, I can change the owner without a problem (incl. subcontainers and objects). Do you know a solution for my problem?
>
> OK, it would seem like you have the proper permissions. What OS?
>
> Like Shay mentions though, if Vista, how are you starting PowerShell?
>
> Marco
>
> --
> Microsoft MVP - Windows PowerShell
> http://www.microsoft.com/mvp
>
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
>
> Blog:
> http://marcoshaw.blogspot.com
>
My System SpecsSystem Spec
Closed Thread
Update your Vista Drivers Update Your Drivers Now!!

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
when run powershell script as windows service ,powershell fail powershell fail on winodws 2008 PowerShell 6 01-15-2008 03:20 PM
Powershell problem in querying some remote Windows 2003 servers James PowerShell 1 08-22-2007 12:53 PM
Powershell problem in querying some remote Windows 2003 servers James PowerShell 1 08-22-2007 09:10 AM
SetOwner on an acl not working Angelina PowerShell 4 08-13-2007 04:24 PM
PowerShell RC2 RTF File Problem =?Utf-8?B?Um9iZXJ0IEJlcm5zdGVpbg==?= PowerShell 2 09-28-2006 02:20 PM


Vistax64.com 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 2005-2008

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 47 48 49 50 51