\n Hi, and welcome to the PowerShell forum! \n\n\nDon’t apologize for being a “noob” or “newbie” or “n00b.” There’s just no need – nobody will think you’re stupid, and the forums are all about asking questions. Just ask! \n\n\nUse a descriptive subject. Don’t say “Need help” or “PowerShell Help”, actually summarize what the problem is. It helps the rest of us keep track of which problem is which. \n\n\nDon’t post massive scripts. We’re all volunteers and we don’t have time to read all that, nor will we copy…\n <\/blockquote>\n<\/aside>\n\n
<\/p>","upvoteCount":0,"datePublished":"2021-03-19T19:45:36.000Z","url":"https://community.spiceworks.com/t/setting-ownership-of-existing-user-homedrive-files/794368/8","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"
Oops sorry. Edited the post so its correct now.<\/p>\n
James.<\/p>","upvoteCount":0,"datePublished":"2021-03-19T19:49:44.000Z","url":"https://community.spiceworks.com/t/setting-ownership-of-existing-user-homedrive-files/794368/9","author":{"@type":"Person","name":"james-sackville-school","url":"https://community.spiceworks.com/u/james-sackville-school"}},{"@type":"Answer","text":"
my bad , try like so:<\/p>\n
$folders = get-childitem \"\\\\FILESERVERNAME\\data2\\2012\"\n\nforeach($user in $folders){\n write-verbose \"Folder: $($user.fullname)\" -verbose\n write-verbose \"User: $(\"$env:USERDOMAIN\\$(split-path $user.name -leaf)\")\" -verbose\n ICACLS (\"$($user.fullname)\") /setowner (\"$env:USERDOMAIN\\$(split-path $user.name -leaf)\")\n}\n<\/code><\/pre>","upvoteCount":0,"datePublished":"2021-03-19T19:49:55.000Z","url":"https://community.spiceworks.com/t/setting-ownership-of-existing-user-homedrive-files/794368/10","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"Thanks, that runs now without error.<\/p>\n
It only says one file processed though how do I make it so it processes the files and folders within the homedrive for users?<\/p>\n
Thanks,<\/p>\n
James<\/p>","upvoteCount":0,"datePublished":"2021-03-19T19:52:41.000Z","url":"https://community.spiceworks.com/t/setting-ownership-of-existing-user-homedrive-files/794368/11","author":{"@type":"Person","name":"james-sackville-school","url":"https://community.spiceworks.com/u/james-sackville-school"}},{"@type":"Answer","text":"