whenz
asked on
Windows File Server - Get Access to all Files on NTFS Share
I have a Windows 2012 Filecluster. As I am during a fileserver migration, I need to delete all files and folders from the department share. Although I am domain admin, I don't have access to all folders / files.
I can take ownership manually and grant myself access to the files. As there is a large amount of files, I would like to run this automated e.g. using a batch or powershell.
How can I get access to all files on my fileshare?
Thanks!
I can take ownership manually and grant myself access to the files. As there is a large amount of files, I would like to run this automated e.g. using a batch or powershell.
How can I get access to all files on my fileshare?
Thanks!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Alternately, you can create an empty folder on a different drive, then use Robocopy with the "/B" (backup) mode, combined with /PURGE to delete files without having to take ownership of them.
1) Create directory C:\FOO
2) Files to be deleted: D:\OLDDATA\ (all files, folders & subfolders)
Robocopy command:
1) Create directory C:\FOO
2) Files to be deleted: D:\OLDDATA\ (all files, folders & subfolders)
Robocopy command:
robocopy C:\FOO D:\OLDDATA /B /PURGE /NOCOPY
The /B runs the command in backup mode, which invokes it as a system process and bypasses file permissions, the /PURGE will delete any files not found in the source. You may need to specify /E to recurse into sub-folders, but I don't think so.
Remove-Item c:\folder_name\*