Remove-Item -Force fails with "Access Denied", not without -Force
hi,
i'm not sure right forum, don't hesitate redirect me if that's not case.
i'm experiencing rather odd situation remove-item used against files reside on qnap ts-109ii nas (runs linux flavor , version of samba):
ps //pnjnas/pi/jeedom/backup> remove-item -force .\foo\backup-1.212.0-2015-12-18-02h00.tar.gz remove-item : cannot remove item \\pnjnas\pi\jeedom\backup\foo\backup-1.212.0-2015-12-18-02h00.tar.gz: access path denied. @ line:1 char:1 + remove-item -force .\foo\backup-1.212.0-2015-12-18-02h00.tar.gz + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : invalidargument: (\\pnjnas\pi\jee...18-02h00.tar.gz:fileinfo) [remove-item], argum entexception + fullyqualifiederrorid : removefilesystemitemargumenterror,microsoft.powershell.commands.removeitemcommand ps //pnjnas/pi/jeedom/backup> remove-item .\foo\backup-1.212.0-2015-12-18-02h00.tar.gz
when "remove-item -force" fails, "remove-item" works, , deleting other means (windows explorer, or [io.file]::delete('\\pnjnas\pi\jeedom\backup\foo\backup-1.212.0-2015-12-18-02h00.tar.gz') ) works.
any clue?
hi sba923,
sorry late reply.
>>when "remove-item -force" fails, "remove-item" works,
example 3: delete hidden, read-only files ps c:\> remove-item -path c:\test\hidden-ro-file.txt -force command deletes file both hidden , read-only. uses path parameter specify file. uses force parameter delete it. without force, cannot delete read-only or hidden files.https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.management/remove-item
best regards,
andy
please remember mark replies answers if help.
if have feedback technet subscriber support, contact tnmff@microsoft.com.
Windows Server > Windows PowerShell
Comments
Post a Comment