I have had disk issues with users using Terminal Servers in Windows 2003

I have a Windows 2003 Terminal Server environment.  Users do not have roaming profiles, therefore, they are saving all sorts of documents on their desktops and deleting items that just sit in the users recycle bin.

Does anyone have a script that I could run which would delete all users contents from the recycle bin ?
CaussyRAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
CaussyRConnect With a Mentor Author Commented:
Hi SjoerdvW,

I tried the script but it didn't do anything ... :o(
0
 
SjoerdvWCommented:
Take a look at this URL: http://social.technet.microsoft.com/Forums/en/ITCG/thread/7ae0bc10-5c17-44e9-9192-9c5de54b7072

discuss you're question with some sample code...
0
 
CaussyRAuthor Commented:
Thanks - I have seen this, but how do I run the script. I am running XP SP3, and I tried to run cscript rcb.vbs but the command does not exist. Do I need to install something in XP ?
0
 
SjoerdvWCommented:
try wscript rcb.vbs (or just double click the script).
The script will not give any output, but empty all users recycle bins...
Const strRecycler = "\\RECYCLER\\"
Set objSWbemServices = GetObject _
    ("WinMgmts:Root\Cimv2")
Set colUsers = objSWbemServices.ExecQuery _
    ("Select * From Win32_UserAccount")
For Each objUser In colUsers
    Set colDisks = objSWbemServices.ExecQuery _
        ("Select * From Win32_LogicalDisk " & _
        "Where DriveType = 3")
    For Each objDisk In colDisks
        Set colDeletedFiles = objSWbemServices.ExecQuery _
        ("Select * From Cim_DataFile Where Drive = '" _
        & objDisk.DeviceId _
        & "' And Path = '" & strRecycler & objUser.Sid & "\\' " _
        & "And Hidden = False")
        For Each objDeletedFile In colDeletedFiles
            objDeletedFile.Delete
        Next
        Set colDeletedFolders = objSWbemServices.ExecQuery _
        ("Select * From Win32_Directory Where Drive = '" _
        & objDisk.DeviceId _
        & "' And Path = '" & strRecycler & objUser.Sid & "\\' " _
        & "And Hidden = False")
        For Each objDeletedFolder In colDeletedFolders
            objDeletedFolder.Delete
        Next
    Next
Next

Open in new window

0
All Courses

From novice to tech pro — start learning today.