Delete Dated Subfolders

Windows No Comments

I have a backup scheme that creates a folder structure such as this…


X:\BACKUP
X:\BACKUP\SERVER1
X:\BACKUP\SERVER1\BACKUP-10-27-2012
X:\BACKUP\SERVER1\BACKUP-10-28-2012
X:\BACKUP\SERVER1\BACKUP-10-29-2012
X:\BACKUP\SERVER1\BACKUP-10-30-2012
X:\BACKUP\SERVER2
X:\BACKUP\SERVER2\BACKUP-10-27-2012
X:\BACKUP\SERVER2\BACKUP-10-28-2012
X:\BACKUP\SERVER2\BACKUP-10-29-2012
X:\BACKUP\SERVER2\BACKUP-10-30-2012

I only wanted to keep the last 2 backups in each subfolder. Here is a script that will do just that.

Contents of x:\backup\cleanup-backups.bat:


@echo off
x:
cd \backup
for /f "tokens=*" %%i in ('dir /b /a:d') do (
pushd %%i
for /f "skip=2 tokens=*" %%g in ('dir /a:d /b /o:-d') do rmdir "%%g" /s /q
popd
)
exit

Worked like a charm. Afterwards I ended up with:


X:\BACKUP
X:\BACKUP\SERVER1
X:\BACKUP\SERVER1\BACKUP-10-29-2012
X:\BACKUP\SERVER1\BACKUP-10-30-2012
X:\BACKUP\SERVER2
X:\BACKUP\SERVER2\BACKUP-10-29-2012
X:\BACKUP\SERVER2\BACKUP-10-30-2012

Software Activation Workaround

Windows No Comments

Was working in a local Dr. Office who is no longer paying a subscription/maintenance on their software since I am now taking care of supporting them. All of a sudden, without warning, their software required activation. I have saved the activation file for the server but this time it didn’t work to just put the file back. Turns out it was connecting back to their activation server. I ended up tracking down the solution with…


c:\>ipconfig /displaydns

Windows IP Configuration

         activate.softwareco.com
         ----------------------------------------
         Record Name . . . . . : activate.softwareco.com
         Record Type . . . . . : 1
         Time To Live  . . . . : 601260
         Data Length . . . . . : 4
         Section . . . . . . . : Answer
         A (Host) Record . . . : 8.8.8.8

c:\>

At this point I knew that it was resolving “activate.softwareco.com”. I simply added the following line to the hosts file and the server no longer checks for activation and my LEGIT license file still works!


127.0.0.1	 activate.softwareco.com
*Obviously for privacy and security the “activate.softwareco.com” is a fictional domain. The subdomain was identical but the domain is fictional.

Vista Quarks

Windows No Comments

I think I have decided that I very much dislike Windows Vista. However, a few things that I always seem to forget where they are that can help me when I’m in a hurry are…

Run program with administrative privileges:


Start > Type the program in the Search Box. (for example: cmd)
Hold Shift + Control then hit Enter.
UAC will then request permission to run as Administrator.

Turn off/on User Account Control:


Start > Type "msconfig" in the Search Box.
UAC will ask for permission.
Click on the Tools tab.
Select "Disable UAC" or "Enable UAC".
Click on "Launch"

Windows Fonts

Windows No Comments

I have been doing some work lately for a couple of screen printing/vinyl businesses. One of the hardest things is matching fonts to certain designs. I use Corel Paint Shop Pro X for any graphics I create. It has most of the tools needed and is capable of doing some basic Vector graphics with Fonts. One of the programs I found that I have used to help me match fonts is FastFontPreview by Lanmisoft. I have included a screen shot so you can see what I am talking about. It gives you a preview of all your fonts and you can customize the text.

fastfontpreview1

A few websites I found to download fonts are http://www.fontspace.com and http://www.creamundo.com.

Refresh Desktop after Registry Changes

Windows No Comments

I constantly use registry changes in login scripts but sometimes if you make changes to the wallpaper or other display properties through the registry they don’t appear until you restart or logoff/login. At the end of a registry import or change you can simply run this little command to make the screen/desktop refresh with the new changes.


%SystemRoot%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters

CCleaner on Startup

Windows No Comments

A common program I like to install on Windows boxes is CCleaner which cleans out your Recycle Bin, Temp files, Internet Cache and such. I have literally cleared of 2GB of temp data with this program before. I was looking for a way to run this program automatically and opted to run it at user signon.

You can download CCleaner here.

You can download the REG file or copy and paste to a new .REG file to run it automatically.


Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
"CCleaner"="\"C:\\Program Files\\CCleaner\\CCleaner.exe\" /AUTO"

If you want to change what data is cleared you have to open ccleaner from the start menu and uncheck what you don’t want cleared. When the program is automatically run at startup it will follow the same rules.

VirtualBox 2.1

Linux, MySQL, Virtualization, Web, Windows No Comments

Although I have been a huge fan of VMWare Server I’m not apposed to alternatives. I’ve tried VirtualBox in the past with very little luck due to the Host Networking issues. However, it appears in the latest 2.1 version they have greatly improved on the networking. When I found out the new version had been released I was quick to download the pre-compiled version, which falls under the VirtualBox Personal Use and Evaluation License (PUEL). The license doesn’t matter to me because I mainly use it just for testing and at the School which is completely under the PUEL.

Host Networking worked without a hitch on a Windows XP Professional SP3 host as well as my Ubuntu Intrepid Ibex 8.10 setups. I think this product has finally, truely, entered the game! I’m sure it will still take some time for the Open Source Edition to enter the Repos for Ubuntu. But I expect to see great things from this.

Empty File Size

Windows No Comments

I was recently working on graphing some network information. I like to use CactiEZ running on a VMWare Server. I was trying to graph hard drive space on a Windows 2003 box. I was wanting to make sure the graphs are truely representing whats there so I wanted to make some drastic changes so they would be present in the network graphs. In comes fsutil.

To create an empty file with a specified file size use:

fsutil file createnew [FileName.Ext] [size]

Obviously replace [FileName.Ext] with a filename. Then [size] with the filesize in bytes. For example I created a couple of 100GB files. I typed : fsutils file createnew dummy.file 107374182400.

To figure out what size in gigabytes for example.. 10GB = 10 * 1024 = 10240MB = 10240 * 1024 = 10485760KB = 10485760 * 1024 = 10737418240 bytes

Here is an example of adding two 100GB files and then deleting them:
graph_47_1

14 Windows Commands

Windows No Comments

Thought this was very useful information…

http://dailycupoftech.com/2007/02/09/14-windows-command-line-tricks/

RDP Remote Desktop Connection in XP PRE-SP3

Windows No Comments

I always like to live on the edge so I slipstreamed my XP cd’s with the PRE-SP3. One feature that quit working is the RDP client. The fix is simple.
Windows XP Remote Desktop Connection software

Open a command prompt in the same window where you saved the file. Then run:

MSRDPCLI.exe /T:%temp% /C
msiexec.exe /a %temp%\msrdpcli.msi /qb TARGEETDIR=c:\windows

« Previous Entries