Hey Scripting Guy!! I have read, lots of posts about the same topic... not so good so far... this is what I need to do...
Under C:\Users\ -I have a lot users... I need to delete those folders/subfolders/files...
but I need to -Exclude some other folders like my own folder + Administrator + Default...
The problem is that the scrpt is ONLY working If I own all the Folders/SubFolders/Files
$FoldersC3P = "Default","Administrator"
Get-ChildItem "C:\Users" -Force | `
Where-Object {$_.PsIsContainer -eq $true} | ForEach { If($FoldersC3P -notcontains $_.Name) { Remove-Item
-Recurse -Force $_.FullName }}
How can I change the Owner and get permissions of Folders/SubFolders and Files of all of them but -Exclude Folders AND CONTENT!
I don't want to change the files/folder owner under Default folder or some other Excluded folder...
I tried usign Get-Acl/Set-Acl with -Recurse (to get all the files/foldes) and -Exclude (to exclude the non needed files/foldes) without a good result.
Any suggestion for the Owner thing...
Thanks a lot!!!