Tag Archive: script



[tech]I think in my previous articles, Backup up your cell phone in three easy steps and Dropbox or Copy, I might have given people the impression that the Copy was ONLY for backing up your cell phone pics. That is actually just an awesome benefit of the copy service, where it really shines is when you install it on your computer or laptop and use it as a ton of FREE online Cloud storage.

After signing up for the copy service (remember click this link and you get an EXTRA 5 GIGS totally free for a total of 20 GIGS!) Sure, you can (and should) install it on your android or apple phone, but definitely install it on your computer too. It simply creates an extra folder on your computer called “Copy” (imagine that). Then, whatever files or folders you put in that “copy” folder is “mirrored” to the cloud. Now, notice I said “mirrored”, that is very important because if you delete the file from your computer, it deletes it from your copy account online too. So that is why it is NOT a true backup service (no cloud storage used in this way EVER is a backup). Think of it as a duplicate if your computer crashes, but if you delete, rename, or move the file, it will do the same in your cloud storage folder.

Now from any computer connected to the internet, or even your phone, you can browse to that file. Now, if you have it installed on your phone, it will not download a copy of the files to keep it in sync with your cloud storage, which is a good thing since most phones do not have that type of available space but If you install it on your home computer and a laptop, it will download a copy to each computer and keep everything in perfect sync, which is ideal for most of us. Imagine you can now work on a file or edit a photo, rename files, or do whatever on the road and it updates the file on your home computer. No more lost revisions! You can tell it not to do this per folder if you like though, maybe if you have limited space on one of your devices or simply choose not to use this feature.

You should always keep a separate copy of all your important files on another service or external hard drive, that’s the only way to have a true backup, and I recommend at least two other devices. This is a quick way to achieve a partial quick copy though.

Remember if you click the link above or here it will give you an extra 5 Gigs free, I don’t know how long they will have this offer, but why miss out on a total of 20 FREE GIGS! Plus I get 5 Gigs free for referring you, so I certainly appreciate it.

Take care and God Bless.

This is a very simple batch file that pings a host. Just double click to run it, enter the IP or computer name you would like to ping, and it will continuously ping that computer, switch, or device with a text file log. It pings 60 times, then gives a summary, then another 60 and summary, and it keeps going till you stop it. Great if you are going home for the day and want to watch to see if a network or device is dropping at night.

Very useful for determining if you have a bad cable, network traffic, etc.

The log file will automatically output to the same directory you run the script from.

Simply copy this code to a file and name it ping_with_timestamp.bat or whatever you want as long as it ends in .bat or click here to download zipped file containing the script ping_with_timestamp

@echo off
:: Bill Wilson
:: 03-19-2013

setlocal enabledelayedexpansion

set /p ip=”Enter IP or HOSTNAME: ” %=%
set outfilename=”ping_timestamp_%ip%.txt”

echo. ********************************************************
echo ____________________________________________________________ > %outfilename%
echo.>> %outfilename%
echo. Results are logging to %outfilename%
echo. ********************************************************
echo. *** RESTARTING this script will overwrite above file ***
echo. ********************************************************
echo. ** This Window only updates approximately every minute *
echo. ********************************************************

echo. Starting Ping to %ip% %date% at %time% >> %outfilename%
echo ____________________________________________________________ >> %outfilename%
echo.>> %outfilename%
echo.>> %outfilename%
:pingloop

echo working…
echo %date% at %time% >> %outfilename%

ping -n 60 %ip%>> %outfilename%

echo ____________________________________________________________ >> %outfilename%
echo. >> %outfilename%
echo. >> %outfilename%

GOTO pingloop
END

Recently we had a problem with very slow logons to one of the Terminal Servers. The terminal server is currently running Windows 2003 Server, but I would bet it could be the same problem on 2008 or even Windows Server 2012.

The problem is with printer caching, usually bloated drivers that get cached when a user logons. HP is famous for having bloated drivers, but Sharp is pretty bad too. We use mostly Sharp copiers across our facility, many, many copiers and lots of Brother printers.  Basically it is a few minute quick fix to get your server working again and then we will automate the process so you can set it and forget it. All we will be doing is deleting a couple of registry keys, so no need to worry, this doesn’t affect drivers or anything, these keys are automatically recreated. Just check these keys and see if you have hundreds or even thousands of entries, if so, you can manually delete the key and your server will return to its lightning fast self. It’s easier and faster to use the script below though.

NOTE: Be patient, the first time we did this it took between 20 and 30 minutes to delete just one key. Also, you will notice if people are currently logging in or logged on that not all entries will be removed, that’s completely fine.

HKEY_CURRENT_USER\Software\SHARP HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\Install\Software\SHARP
HKEY_USERS\.DEFAULT\Software\SHARP

If you have HP copiers, then you will see these keys instead.

HKEY_CURRENT_USER\Software\Hewlett-Packard HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\Install Software\Hewlett-Packard
HKEY_USERS\.DEFAULT\Software\Hewlett-Packard
 

This is a temporary fix, I highly recommend creating the cleanup scripts below to make it a permanent solution. I will attach mine to this article, feel free to download and use them, at your own risk of course, but you will notice they are basic one or two line scripts that simply remove some registry keys. If you are worried just backup the key first.

You will need two scripts, one to call a registry deletion of HKLM and HKU, and the other will call the key deletion of HKCU. We put our scripts in the system32 folder so if you put your script else where, just update the location in the script. This is all really basic stuff so I’m not going to go into too many details.

First, Logon as an Admin user and follow the steps below:

Create script in C:\Windows\system32\ called “CleanupSharp.bat” with this code in it:

regedit /s C:\Windows\system32\CleanupSharp.reg

Create a reg file in C:\Windows\system32\ named “CleanupSharp.reg” with this text in it:

Windows Registry Editor Version 5.00
[-HKEY_USERS\.DEFAULT\Software\SHARP]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\Install\Software\SHARP]

At this point, simply run the CleanupSharp.bat script to get your Terminal Server responding normally again. Then move on to the steps below to make it as fast as it can be. This cleans the user hives, which helps a lot, but not nearly as much as the first script, it is very important though so don’t skip this step lazy ass.

Create script in C:\Windows\system32\ called “CleanupSharp-user.bat” with this code in it:

regedit /s C:\Windows\system32\CleanupSharp-user.reg

Create a reg file in C:\Windows\system32\ named “CleanupSharp-user.reg” with this text in it:

Windows Registry Editor Version 5.00
[-HKEY_CURRENT_USER\Software\SHARP]

 

Now, Let’s automate the process… see below for a zip file with scripts.

Run or open gpedit.msc and go to Computer Configuration->Windows Settings->Scripts and add “C:\Windows\system32\CleanupSharp.bat” to shutdown scripts.

Then go to User Configuration-> Windows Settings-> Scripts and add the other script C:\Windows\system32\CleanupSharp-user.bat to logoff scripts.

Logon as a regular user and that should remove the SHARP current user key on logoff, make sure you logoff then back on to the machine to verify ;-)

If for some reason nobody is logged on to your Terminal Server you can do a reboot and test the shutdown script removes the other keys.

That’s all there is to it! If you use HP, be sure to change the “SHARP” to “Hewlett-Packard”. If you have other copiers or printers, just check them, if there is a ton of lines in the key, then substitute that name in the reg files.

Now enjoy your like new Microsoft Terminal Server :)

Here is the link to the files TS_Printer_Clean