powershell删除项目Windows服务器2012无法正常工作

时间:2016-11-13 00:16:45

标签: powershell cmd delete-file windows-server-2012-r2

我有win-server 2012,我的c:\磁盘已满。 我有一个文件“win2012r22.iso”4GB,这是2014年的旧文件(不在我的任何hyper-v中使用),我无法使用PowerShell作为管理员删除它。 是否有另一种方法/命令来删除该文件,以便释放一些空间?

    Directory: C:\


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d----        10/27/2015   7:05 AM            59
d----        10/27/2015   7:04 AM            59free
d----         5/11/2015   6:21 AM            currports
d----         12/9/2014   8:39 AM            ibmmegaraid
d----         12/9/2014   8:32 AM            IBM_Support
d----         7/26/2012  12:21 AM            PerfLogs
d-r--        12/13/2014   1:14 AM            Program Files
d----        12/13/2014   1:14 AM            Program Files (x86)
d-r--         11/7/2012  10:51 AM            Users
d----        10/28/2016   7:51 AM            Windows
-a---        11/10/2012   2:15 AM    5268344 59.exe
-a---        10/27/2015   6:54 AM   37533435 59free.exe
-a---        10/27/2015   7:02 AM   37533435 59free.zip
-a---        10/27/2015   6:59 AM   37533435 59free1.exe
-a---         5/11/2015   6:25 AM   31225832 59manager.exe
-----         11/3/2016   4:50 AM       3456 bootsqm.dat
-a---         8/30/2015  11:04 AM  666894336 centos7min.iso
-a---         11/7/2012  10:55 AM     254328 hvremote.wsf
-a---         12/9/2014   8:31 AM   86051707 ibmmegaraid.exe
-a---         12/9/2014   8:38 AM   85717226 ibmmegaraid.zip
-a---          1/5/2013   8:42 AM    9078784 LinuxICv34.iso
-a---         11/3/2016   6:02 AM          0 Recovery.txt
-a---        11/10/2012  12:28 AM    1622368 vt.exe
-a---         8/30/2015  10:56 AM    1856768 vt32.exe
-a---         1/16/2014  11:41 PM 4268605440 win2012r22.iso


PS C:\> remove-item c:\win2012r22.iso
remove-item : Access is denied
At line:1 char:1
+ remove-item c:\win2012r22.iso
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (C:\win2012r22.iso:String) [Remove-Item], UnauthorizedAccessException
    + FullyQualifiedErrorId : ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.RemoveItemCommand

remove-item : Cannot find path 'C:\win2012r22.iso' because it does not exist.
At line:1 char:1
+ remove-item c:\win2012r22.iso
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\win2012r22.iso:String) [Remove-Item], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand

PS C:\>

1 个答案:

答案 0 :(得分:1)

请验证以下内容:

  • 仔细检查ISO是否未附加到某个VM。
  • 确保该文件未在其他地方使用。您可以使用handleProcess Explorer等工具检查文件上的打开句柄。
  • 可以通过GUI删除吗?
  • 您可以使用del命令通过CMD删除它吗?