Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
针对服务器上的共享运行Powershell脚本_Powershell_Delete File_Recycle Bin - Fatal编程技术网

针对服务器上的共享运行Powershell脚本

针对服务器上的共享运行Powershell脚本,powershell,delete-file,recycle-bin,Powershell,Delete File,Recycle Bin,我正在本地PC上的服务器上的文件共享上运行powershell脚本。我在脚本中有代码,允许用户选择永久删除某些内容(使用删除项)或使用以下代码将某些内容发送到回收站: [Microsoft.VisualBasic.FileIO.Filesystem]::DeleteFile($file.fullname,'OnlyErrorDialogs','SendToRecycleBin') 当在本地(从我的桌面或从服务器)针对相应位置的本地文件夹运行时,它可以正常工作。一个被识别的文件被删除&立即显示在

我正在本地PC上的服务器上的文件共享上运行powershell脚本。我在脚本中有代码,允许用户选择永久删除某些内容(使用删除项)或使用以下代码将某些内容发送到回收站:

[Microsoft.VisualBasic.FileIO.Filesystem]::DeleteFile($file.fullname,'OnlyErrorDialogs','SendToRecycleBin')
当在本地(从我的桌面或从服务器)针对相应位置的本地文件夹运行时,它可以正常工作。一个被识别的文件被删除&立即显示在回收站中

但是,如果从“我的桌面”运行到文件共享,则会删除该文件,但不会显示在服务器的回收站或本地回收站中。我尝试过UNC命名和映射驱动器命名,并逐渐相信这可能是出于设计


是否有解决方法?

只有从重定向文件夹中删除的文件才会进入回收站。如果您希望能够取消删除通过网络删除的文件,则需要使用第三方实用程序。

我担心这就是解决方案。