Empty Recycle Bin Upon log off

Reading Time: < 1 minute

If you wish to empty a users recycle bin upon log off, copy the below code to a notepad and save with the extension .vsb e.g. clean.vbs

Option Explicit
 
Dim objWshShell, objFSO, objWshNetwork
Dim objRecycleBin, objFolderItems, objItem, strSpecialFolderName
 
‘Setup main variables and objects
Set objWshShell = WScript.CreateObject(”WScript.Shell”)
Set objFSO = CreateObject(”Scripting.FileSystemObject”)
Set objWshNetwork = WScript.CreateObject(”WScript.Network”)
 
Set objRecycleBin = GetSpecialFolderObject(”Recycle Bin”)
Set objFolderItems = objRecycleBin.Items()
For Each objItem In objFolderItems
 If (objItem.Type = “File Folder”) Then 
  objFSO.DeleteFolder(objItem.Path)
 Else
  objFSO.DeleteFile(objItem.Path)
 End If
Next
 
Function GetSpecialFolderObject(NameOfFolder)
 Dim objShellApp, i, objSpecialFolder
 Set objShellApp = CreateObject(”Shell.Application”)
 On Error Resume Next
 For i=0 To 40 ’40 is highest value for special folders
  Set objSpecialFolder = objShellApp.NameSpace(i) 
  If (StrComp(objSpecialFolder.Title,NameOfFolder,vbTextCompare)=0) Then
   Set GetSpecialFolderObject = objSpecialFolder
   Exit For
  End If
 Next
 Err.Clear
End Function

Next, add the script to group policy to run when user logs off.

Please carry out tests before applying on the whole network. This was tested on Windows XP

Thanks

The print spooler failed to reopen an existing printer connection

Reading Time: < 1 minute

If you find you’re receiving the below alert within event viewer, then this is what worked for me:

1) Click Start
2) Type regedit
3) Expand Computer
4) Expand HKEY_USERS
5) Expand S-1-5-18
6) Right click Printers
7) Click New Key and name the key connections

Should stop the alert coming through.

Please be careful when amending the registry. Always make a backup incase issues occur. If unsure, get in touch with an I.T professional.

Error:

“The print spooler failed to reopen an existing printer connection
because it could not read the configuration information from the
registry key S-1-5-18\Printers\Connections. The print spooler could not
open the registry key. This can occur if the registry key is corrupt or
missing, or if the registry recently became unavailable.”

How to clear unneeded files within WSUS 2.0

Reading Time: < 1 minute

1) Logon to your WSUS server
2) Click start
3) Click run
4) Type cmd and press enter
5) Type the path to where the WSUSdebugtool.exe tool is located
6) Next, type wsusdebugtool /Tool:PurgeUnneededFiles and press enter

You may need to wait a few minutes whilst any unneeded files are removed

Check Mailbox sizes Exchange 2007

Reading Time: < 1 minute

Microsoft Exchange 2007 will not allow you to check Mailbox sizes unless you access each mailbox one at a time. To list mailbox sizes, do the following:

1) Access your Exchange Server
2) Open Exchange Management Shell
3) Type or copy the below command and press enter:

Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | ft DisplayName,@{label=”TotalItemSize(MB)”;expression={$_.TotalItemSize.Value.ToMB()}},ItemCount

You can now select all and copy to a notepad to analyse the data

Remove Run From Start Menu

Reading Time: < 1 minute

See below instructions on how to remove run from the start menu via group policy.

1) Access group policy and access the policy you wish to amend (or create a new policy and link as required)
2) Expand user configuration
3) Expand Administrative Templates
4) Click Start Menu and Taskbar
5) Double click ‘Remove run menu from start menu’ and enable