none
Limpeza da Lixeira. RRS feed

  • Pergunta

  • Como eu faço para realizar a limpeza da lixeira via GPO, ou tem alguma script que rode para realizar a limpeza de todas as lixeiras do parque de PCs.

    Att,

     

    Benedito Jr.


    Benedito Jr
    quinta-feira, 16 de julho de 2009 19:38

Respostas

  • Olá,

    Verfique se o script abaixo te atende:

    Dim arrItens (17,2)

    arrItens(0,0)  = "Active Setup Temp Folders"
    arrItens(1,0)  = "Compress old files"
    arrItens(2,0)  = "Content Indexer Cleaner"
    arrItens(3,0)  = "Downloaded Program Files"
    arrItens(4,0)  = "Internet Cache Files"
    arrItens(5,0)  = "Memory Dump Files"
    arrItens(6,0) = "Microsoft Office Temp Files"
    arrItens(7,0) = "Offline Files"
    arrItens(8,0) = "Offline Pages Files"
    arrItens(9,0) = "Old ChkDsk Files"
    arrItens(10,0) = "Recycle Bin"
    arrItens(11,0) = "Remote Desktop Cache Files"
    arrItens(12,0) = "Setup Log Files"
    arrItens(13,0) = "System Restore"
    arrItens(14,0) = "Temporary Files"
    arrItens(15,0) = "Temporary Offline Files"
    arrItens(16,0) = "Temporary Sync Files"
    arrItens(17,0) = "WebClient and WebPublisher Cache"


    ' LIBERA A LIMPEZA DOS ITENS ACIMA

    arrItens(0,1)  = False
    arrItens(1,1)  = False
    arrItens(2,1)  = False
    arrItens(3,1)  = False
    arrItens(4,1)  = False
    arrItens(5,1)  = False
    arrItens(6,1) = False
    arrItens(7,1) = False
    arrItens(8,1) = False
    arrItens(9,1) = False
    arrItens(10,1) = True
    arrItens(11,1) = False
    arrItens(12,1) = False
    arrItens(13,1) = False
    arrItens(14,1) = False
    arrItens(15,1) = False
    arrItens(16,1) = False
    arrItens(17,1) = False


    strPath = "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\"
    strSet = "stateFlags0500"

    set oShell = CreateObject("WScript.Shell")



    For x = 0 to UBOUND(arrItens)
       if arrItens(x,1) = True Then
          oShell.RegWrite strPath & arrItens(x,0) & "\" & strSet , "2", "REG_DWORD"
       Else
          oShell.RegWrite strPath & arrItens(x,0) & "\" & strSet , "0", "REG_DWORD"
       End if
    Next


    Set WSHShell = WScript.CreateObject("WScript.Shell")

    WSHShell.Run "cleanmgr.exe /d c: /sagerun:500", 1, true




    Tem um script que ele deleta (permanente) os itens da lixeira, porém o icone do desktop fica como se estivesse alguma coisa na lixeira. Segue abaixo:

    Const RECYCLE_BIN = &Ha&

    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(RECYCLE_BIN)
    Set objFolderItem = objFolder.Self
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set colItems = objFolder.Items
    For Each objItem in colItems
       objFSO.DeleteFile(objItem.Path)
    Next


    Até mais,

    Jesiel

    Obs.: Se útil, classifique
    • Marcado como Resposta benedito quarta-feira, 22 de julho de 2009 14:58
    sexta-feira, 17 de julho de 2009 13:38

Todas as Respostas

  • Olá,

    Verfique se o script abaixo te atende:

    Dim arrItens (17,2)

    arrItens(0,0)  = "Active Setup Temp Folders"
    arrItens(1,0)  = "Compress old files"
    arrItens(2,0)  = "Content Indexer Cleaner"
    arrItens(3,0)  = "Downloaded Program Files"
    arrItens(4,0)  = "Internet Cache Files"
    arrItens(5,0)  = "Memory Dump Files"
    arrItens(6,0) = "Microsoft Office Temp Files"
    arrItens(7,0) = "Offline Files"
    arrItens(8,0) = "Offline Pages Files"
    arrItens(9,0) = "Old ChkDsk Files"
    arrItens(10,0) = "Recycle Bin"
    arrItens(11,0) = "Remote Desktop Cache Files"
    arrItens(12,0) = "Setup Log Files"
    arrItens(13,0) = "System Restore"
    arrItens(14,0) = "Temporary Files"
    arrItens(15,0) = "Temporary Offline Files"
    arrItens(16,0) = "Temporary Sync Files"
    arrItens(17,0) = "WebClient and WebPublisher Cache"


    ' LIBERA A LIMPEZA DOS ITENS ACIMA

    arrItens(0,1)  = False
    arrItens(1,1)  = False
    arrItens(2,1)  = False
    arrItens(3,1)  = False
    arrItens(4,1)  = False
    arrItens(5,1)  = False
    arrItens(6,1) = False
    arrItens(7,1) = False
    arrItens(8,1) = False
    arrItens(9,1) = False
    arrItens(10,1) = True
    arrItens(11,1) = False
    arrItens(12,1) = False
    arrItens(13,1) = False
    arrItens(14,1) = False
    arrItens(15,1) = False
    arrItens(16,1) = False
    arrItens(17,1) = False


    strPath = "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\"
    strSet = "stateFlags0500"

    set oShell = CreateObject("WScript.Shell")



    For x = 0 to UBOUND(arrItens)
       if arrItens(x,1) = True Then
          oShell.RegWrite strPath & arrItens(x,0) & "\" & strSet , "2", "REG_DWORD"
       Else
          oShell.RegWrite strPath & arrItens(x,0) & "\" & strSet , "0", "REG_DWORD"
       End if
    Next


    Set WSHShell = WScript.CreateObject("WScript.Shell")

    WSHShell.Run "cleanmgr.exe /d c: /sagerun:500", 1, true




    Tem um script que ele deleta (permanente) os itens da lixeira, porém o icone do desktop fica como se estivesse alguma coisa na lixeira. Segue abaixo:

    Const RECYCLE_BIN = &Ha&

    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(RECYCLE_BIN)
    Set objFolderItem = objFolder.Self
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set colItems = objFolder.Items
    For Each objItem in colItems
       objFSO.DeleteFile(objItem.Path)
    Next


    Até mais,

    Jesiel

    Obs.: Se útil, classifique
    • Marcado como Resposta benedito quarta-feira, 22 de julho de 2009 14:58
    sexta-feira, 17 de julho de 2009 13:38
  • Obrigado,


    Os dois atenderam melhor que eu esperava.
    Obrigado.
    Benedito Jr
    quarta-feira, 22 de julho de 2009 14:59