Set owner on a network share folder

Dec 4, 2014 at 5:20 PM

i just downloaded and installed this module to do one task: delete multiple old profiles on our servers. Manually, i have to go on a network share where the profile is, set the owner (myself), set the rights for the owner, and delete the profile folder. It works fine but we have hundred of profiles to delete, so i want to do a script.

I tried the "set-owner" command but without success:
Set-Owner -Account DOMAIN\myself -Path \\directory...
Set-NTFSOwner : Le fichier spécifié est introuvable. (Exception de HRESULT : 0x80070002): [\?\UNC\ \\directory...]
In english, i translate: "specified file is not found". Notice the "\?\UNC\" before my path.

I test this command on a local directory and it works fine. I don't understand why i can set manually an owner and i cannot using this Cmdlet. Any ideas?

(Sorry for my english, i am french)
Dec 9, 2014 at 7:16 PM

can you be a bit more specific about the environment?
PS C:\Users\Administrator\Desktop> Set-Owner \\\DFS1\Homes\a877777 -Account a\a877777 -PassThru

Item                                                     Owner
----                                                     -----
\\\DFS1\Homes\a877777                            A\a877777
I have just tried the following and it worked: