Recently, I have been going through a number of my departments procedures. It seems that during our windows patching cycles updates continuously fail on servers due to insufficient C: drive space. While cleaning up the necessary files for patching to complete is far from difficult, it is relatively monotonous. With this in mind I set out to write a simple script to clear many of the temporary file locations on Windows 2003, 2008 and 2012 servers, thus automating the C drive cleanup process for my team and I:

NOTE: After copying and pasting this script into a .txt file please make sure to rename/save as filename.bat (filename can be changed to whatever title you would like the script to be named - ed.). This process might require you to "show hidden files and paths" to verify the file is named correctly.  Also, make sure to run this script  as administrator from the server you wish to cleanup. This can be done simply by right clicking the script ([filename].bat) and selecting "run as administrator"

REM remove any dump files or temp files
DEL %SystemDrive%\*.TMP /S
DEL %SystemDrive%\*.DMP /S

REM delete past KB updates from Microsoft
forfiles /p "%WinDir%\$hf_mig$" /s /m *.* /c "cmd /c Del @path" /d -180

REM delete Performance Information and Tools logs and Reliability and Performance Monitor logs
forfiles /p "%SystemDrive%\perflogs" /s /m *.* /c "cmd /c Del @path" /d -180

REM remove old installation of TSM backup agent installation
rmdir /s /q %SystemDrive%\tsm_images

REM remove all files found in the windows temporary file location
del /f /q "%temp%\*.*"

REM remove file used for past Windows service pack installations
if exist "%WinDir%\servicepackfiles\i386" DEL "%WinDir%\servicepackfiles\i386\*.*" /s /q

REM if the user folder exists remove specific file types if they are found to clear up space. If not jump to skip.
if not exist "%WinDir%\Users\*.*" goto skip
if exist "%WinDir%\Users\*.zip" del "%WinDir%\Users\*.zip" /f /q
if exist "%WinDir%\Users\*.gif" del "%WinDir%\Users\*.gif" /f /q
if exist "%WinDir%\Users\*.jpg" del "%WinDir%\Users\*.jpg" /f /q
if exist "%WinDir%\Users\*.png" del "%WinDir%\Users\*.png" /f /q
if exist "%WinDir%\Users\*.bmp" del "%WinDir%\Users\*.bmp" /f /q
if exist "%WinDir%\Users\*.avi" del "%WinDir%\Users\*.avi" /f /q
if exist "%WinDir%\Users\*.mpg" del "%WinDir%\Users\*.mpg" /f /q
if exist "%WinDir%\Users\*.mpeg" del "%WinDir%\Users\*.mpeg" /f /q
if exist "%WinDir%\Users\*.ra" del "%WinDir%\Users\*.ra" /f /q
if exist "%WinDir%\Users\*.ram" del "%WinDir%\Users\*.ram"/f /q
if exist "%WinDir%\Users\*.mp3" del "%WinDir%\Users\*.mp3" /f /q
if exist "%WinDir%\Users\*.mov" del "%WinDir%\Users\*.mov" /f /q
if exist "%WinDir%\Users\*.qt" del "%WinDir%\Users\*.qt" /f /q
if exist "%WinDir%\Users\*.asf" del "%WinDir%\Users\*.asf" /f /q

REM if the users\users folder exists remove specific file types if they are found to clear up space. If not go jump to tempFiles
if not exist %WinDir%\Users\Users\*.* goto tempFiles /f /q
if exist %WinDir%\Users\AppData\Temp\*.zip del %WinDir%\Users\Users\*.zip /f /q
if exist %WinDir%\Users\AppData\Temp\*.gif del %WinDir%\Users\Users\*.gif /f /q
if exist %WinDir%\Users\AppData\Temp\*.jpg del %WinDir%\Users\Users\*.jpg /f /q
if exist %WinDir%\Users\AppData\Temp\*.png del %WinDir%\Users\Users\*.png /f /q
if exist %WinDir%\Users\AppData\Temp\*.bmp del %WinDir%\Users\Users\*.bmp /f /q
if exist %WinDir%\Users\AppData\Temp\*.avi del %WinDir%\Users\Users\*.avi /f /q
if exist %WinDir%\Users\AppData\Temp\*.mpg del %WinDir%\Users\Users\*.mpg /f /q
if exist %WinDir%\Users\AppData\Temp\*.mpeg del %WinDir%\Users\Users\*.mpeg /f /q
if exist %WinDir%\Users\AppData\Temp\*.ra del %WinDir%\Users\Users\*.ra /f /q
if exist %WinDir%\Users\AppData\Temp\*.ram del %WinDir%\Users\Users\*.ram /f /q
if exist %WinDir%\Users\AppData\Temp\*.mp3 del %WinDir%\Users\Users\*.mp3 /f /q
if exist %WinDir%\Users\AppData\Temp\*.asf del %WinDir%\Users\Users\*.asf /f /q
if exist %WinDir%\Users\AppData\Temp\*.qt del %WinDir%\Users\Users\*.qt /f /q
if exist %WinDir%\Users\AppData\Temp\*.mov del %WinDir%\Users\Users\*.mov /f /q

REM remove temporary debug and cache files for IIS installations
del "%SystemDrive%\inetpub\wwwroot\cache\*.*" /f /q
del "%SystemDrive%\debugdiag\*.*" /f /q

REM remove any un needed past Intel installation files from computer.
if exist %SystemDrive%\Intel rmdir /S /Q %SystemDrive%\Intel
if exist %SystemDrive%\i386 rmdir /S /Q %SystemDrive%\i386

REM removes patch catch folder location found in Windows Server 2008 and above
rmdir /s /q "%WinDir%\Installer\$PatchCache$\"

REM If the location exists recurse through all User folders and cleanup temporary file locations(Win 7, 8)
IF EXIST "%SystemDrive%\Users\" (
    for /D %%x in ("%SystemDrive%\Users\*") do (
        rmdir /s /q "%%x\AppData\Local\Temp"
        mkdir "%%x\AppData\Local\Temp"
  rmdir /s /q "%%x\AppData\Local\Microsoft\Windows\Temporary Internet Files"
  mkdir "%%x\AppData\Local\Microsoft\Windows\Temporary Internet Files"

REM If the location exists recurse through all documents and settings files and cleanup temporary file locations(Win XP)
IF EXIST "%SystemDrive%\Documents and Settings\" (
    for /D %%x in ("%SystemDrive%\Documents and Settings\*") do (
        rmdir /s /q "%%x\Local Settings\Temporary Internet Files"
        mkdir "%%x\Local Settings\Temporary Internet Files"
  rmdir /s /q "%%x\Local Settings\Temp"
        mkdir "%%x\Local Settings\Temp"\
  forfiles "%%x\application data\vulscan" /s /m *.log* /c "cmd /c Del @path" /d -90
  forfiles "%%x\application data\vulscan" /s /m *mergedgetvulnerabilities* /c "cmd /c Del @path" /d -10

REM run windows disk cleanup on the C drive.
cleanmgr /sagerun:1 /c

This script is now being used by the majority of my team members and has taken a job that can take up to 10 minutes and reduced it down to under 1. Our server monitoring team is even looking into pushing this script every time it is determined that a servers main drive falls under 800MB of free space which could save our team even more time.

My office recently ran across an issue which prevented users from being able to search Lync by username or ID. The only way around this was to run searches with users email accounts after upgrading to Skype for Business 2015 (Lync 2013).

When working on some of our older systems a week back I came across an IDRAC that refused to cooperate. Now it could have been that everyone in the office had forgotten the password but I think it was that the IDRAC itself was not remembering its intended function. With this in mind I was not surprised when the IDRAC threw us an error saying "it had reached the maximum user sessions" and no other users could log on. I knew as well as everyone else in the office that the maximum user sessions had not been reached but that didn't mean that we hadn't hung the device with our incessant login attempts. So, due to our incorrect logon persistence, we got the chance to login to the server through RDP in order to clear out the offending IDRAC "sessions":


  • IDRAC 7 
  • Access to server OS attached to IDRAC 
First, log onto the corresponding server.

Open a command prompt as administrator by right clicking cmd.exe and then selecting "Run as administrator"

Go to the IDRAC directory through the command prompt window (c:\
program files (x86)\dell\sysmgt\idrac) by typing in the the following command: cd c:\program files (x86)\dell\sysmgt\idrac.

Next use the following command:  racadm -r [servername] -u -p racreset

This will cause the IDRAC to reset and allow the user to log back in.

racadm can also be used for several other operations on a Dell IDRAC. For a complete list of these commands its best to go to Dell technical support for the most up to date list of commands for your specific IDRAC version
When I started my last job the company that I was working for shared it's printers from one central server. While this method works in practice there are several benefits that a Windows Print Server brings to a network. This being the case until I was able to fully implement our new Windows Print Server into the environment I had to set up several shared printers on their Windows Server. The below directions are pulled from a Windows 2003 installation but have not changed much with the more recent iterations of Windows Server:

First, Log into server and navigate to Printers and Faxes. This menu can be found under control panel. Click on Add Printer

When presented with the Add Printer Wizard click on "Next"
Choose "Local printer attached to this computer", make sure "Automatically detect and install my Plug and Play printer" is unchecked and click "Next"

On the next screen choose the bullet located next to "Create a new port" and in the "type of port" drop down box select "Standard TCP/IP Port"

When presented with the Add Standard TCP/IP Printer Port Wizard click "Next"

When presented with the next window add your printers IP address in "Printer Name or IP Address". The "Port Name" field should be populated automatically. 

Verify the information is correct and hit Finish

Next, you will be prompted to install the printer drivers. If the driver is available via Windows it will show in the presented list otherwise you will need to add the driver manually by using the "Have Disk" button and pointing to the correct location. In our case the driver was found and so we select it and click "next"

In the next window, if you already have a similar driver installed on the computer, you will be prompted to "keep the existing driver (recommended)" or "replace the existing driver." More often than not you will just keep the driver that is already in place. Click "Next" to continue. 

In the "Printer Name" field add what you would like your printer to be displayed as and click "next". This will complete the installation and add your new printer to the computer. 

After the printer has been successfully installed go to "Printers and Faxes" (Printers and Devices in Windows Server 2008 and above - ed.)  

Right click on the server that you just installed and select "sharing". 

Select the box next to "Share Name" and type in the name you would like users to see when selecting the shared printer. Click "Next" 

In the next window fill out the location and any comments and click "Next". 

Click the box next to "Yes" if you would like to test your new share otherwise leave "No" selected and click "Next".

And finally in the next window select "finish"

For quite a few iterations now iOS has had the option of something it calls text replacement. This feature allows a user to type in a string of characters and have the operating system replace it with whatever they have predefined. For example while texting a friend (or enemy for that matter - ed.) a user could put "oic" and have the actual phrase "oh I see" populate in the text message. This can be very helpful when quickly typing on a cell phone, tablet or other mobile device. A little known fact, however, is that Microsoft Outlook actually has this functionality as well: 

In Microsoft Outlook go to file in the upper left hand corner of the window. 

When presented with the new window select "options" from the column on the left hand side 

In the new window select "mail" from the left hand column

Your main window display should now give you an option labeled "Spelling and Autocorrect". Click this button. 

In the new window select 'AutoCorrect Options..."

you will now see a window with a "Replace text as you type" field option. Make sure the check box is checked next to this option. Type the shortcut you would like added underneath "Replace:" and what you would like it to relate to under "With:".  Ex: Replace: "oic" with "oh I see" (Please see image below) 

Click OK to save changes. Go to a new email and in the body type "oic" hit the space bar and "oh I see" will appear. 
Next PostNewer Posts Previous PostOlder Posts Home