I am trying to clean up the homefolder drive where I work. Currently there are a ton of homefolders that do not have matching AD accounts. I have identified all of the folder paths, and ran scripts to pull the paths into txt files. There are 2 sites each
for 2 different networks I am doing this on. 2 sites on one network and 1 site on the other network worked fine, but I am having issues on the last site\network.
For each site and network, all homefolders reside on a share on a NetApp, and the destination in the script is a separate folder within the same share on the same NetApp as its source location.
On the site\network I am having issues with, the structure looks like this
\\location\users1
\\location\users2
\\location\users3
\\location\users4
I have created an archive folder \\location\Archive\Delete_On_Date.
My script looks like this
$file1 = Get-Content \\sourcefiles\homefolder_archive_date.txt
move-item -path $file1 -destination \\location\Archive\Delete_On_Date
I get the following error
move-item : Access to the path '<Provides a path to one of the paths listed in the source file>' is denied
I have checked, double checked, and triple checked permissions, looking for explicit deny, looking at both the share and NTFS permission sets. I have tried running as user and as admin, no matter what, I get this error. I have tested manually
moving a folder that gets the access denied error and it is successful.
NOTE: The really odd part of this is that after tons of testing and troubleshooting, I found that the script works perfectly fine on the users1 and users4 folders, but errors on the users2 and users3 folders.
Any ideas?