+ Post New Thread
Results 1 to 2 of 2
Windows Server 2000/2003 Thread, Script for Recycler clear up in Technical; Hi Guys, bit of help needed .... Pretty Pwease Back into a windows Enviroment after being in *Nix / Apple ...
  1. #1

    Join Date
    Mar 2012
    Location
    Stafford
    Posts
    33
    Thank Post
    6
    Thanked 7 Times in 5 Posts
    Rep Power
    10

    Script for Recycler clear up

    Hi Guys,

    bit of help needed .... Pretty Pwease

    Back into a windows Enviroment after being in *Nix / Apple enviromentt for years ...

    One of the problems we are having is the Network recyler folder is filling some 200 Servers up with space - Folder redirect is a mess and GPO cannot be touched - Else i would of just cleared this up ...

    What im after is a VBSCRIPT i can just run against the Home drives of network user to erase all the recycler data in one go

    so

    \\servername\home\username\recycler << this folder gets blatted

    Has any kind sir got a script that just does this - or can somebody point me in the right direction .... Pwetty Pwease ?

    Thanks

  2. #2
    noxigen's Avatar
    Join Date
    May 2013
    Location
    Nashville, TN USA
    Posts
    5
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Save this VBScript snippet to Whatever.vbs. Create a text file with the name of each server per line, like:
    Code:
    server1
    server2
    ....
    Replace "C:\servers.txt" with the name of that text and run the script from a command prompt, like:

    Code:
    cscript /nologo Whatever.vbs
    Here's the code:

    Code:
    serverList = "C:\servers.txt"
    
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    
    
    servers = Split(fso.OpenTextFile(serverList, 1, False).ReadAll, vbCrLf)
    
    
    For Each servername In servers
        
        homePath = "\\" & servername & "\home"
        
        WScript.StdOut.WriteLine "Checking '" & homePath & "'..."
        
        If fso.FolderExists(homePath) Then
            
            On Error Resume Next
            For Each userFolder In fso.GetFolder(homePath).SubFolders
                
                Err.Clear
                WScript.StdOut.Write vbTab & "Emptying '" & userFolder & "'..."
                
                fso.DeleteFile userFolder & "\*.*", True
                
                For Each subFolder In fso.GetFolder(userFolder).SubFolders
                    fso.DeleteFolder subFolder, True
                Next
                
                If Err.Number = 0 Then
                    WScript.StdOut.WriteLine "Success!"
                Else
                    WScript.StdOut.WriteLine "Failed."
                End If
                
            Next
            On Error GoTo 0
            
        End If
    Next
    Let me know how it goes.

SHARE:
+ Post New Thread

Similar Threads

  1. Good practice for server set up for thin clients
    By tosca925 in forum Thin Client and Virtual Machines
    Replies: 2
    Last Post: 17th March 2007, 06:01 PM
  2. VBS script for prestaging computers anyone?
    By ChrisH in forum Scripts
    Replies: 7
    Last Post: 23rd June 2006, 09:59 AM
  3. Backup Script for NT backup and Robocopy
    By ChrisH in forum Scripts
    Replies: 12
    Last Post: 20th October 2005, 01:01 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •