Archive for Tools – Page 7

Cleanup Log Files (Batch vs PowerShell)

Back in Nov 2006 I wrote a blog post on creating a batch command file that could be used to cleanup old IIS log files. Then, in Dec 2007, I wrote an updated blog post with another solution. I thought I would update those posts for 2013 using PowerShell.

OLD SCHOOL (Batch command file)

Both of the above solutions were written in the SBS 2003 era, but will work with SBS 2008/2011. Both versions will let you identify the number of days to keep (I suggest 30 days), and will scan sub-folders under the specified folder.

As a quick review, here’s how to implement my Dec 2007 solution:

  1. Download the zip file from my web site which contains three files: .vbs, .bat, and .log files.
    image
  2. Extract and copy those three files to your desired directory. I normally use c:\scripts.
  3. Edit the .bat file to point to the appropriate parent folder of the log files to be cleaned up, and the number of days of log files to retain.
    For Windows 2008 R2, my .bat file looks like this:
    image
  4. NOTE: If running this for the first time, you may wish to test drive the script, without actually deleting any files. To do this, edit the deloldfiles.vbs file and comment out the ‘file.delete’ line in the script by adding a single quote (‘) to the start of the line. If all works, go back and remove the single quote.
  5. After testing the script manually, all that is left is  to schedule the script to run on a weekly or monthly basis, as desired.

NEW SCHOOL (PowerShell)

While batch files are still supported in the Windows 2008 R2/Windows 2012 era, we need to start getting comfortable with using PowerShell scripts. I found a handy PowerShell script that does this from the Microsoft forum.

This script used the “start-transcript / stop-transcript” command to create a history log of files deleted.

  1. Download the PowerShell script file (deloldfiles.ps1) from my web site.
  2. Edit the script, as necessary, to point to the appropriate parent folder and the number of days to retain, and save.
  3. NOTE: the script includes a “–whatif” option that allows us to run the script without actually deleting anything. If the script appears to work as expected, then simply remove the –whatif option from the script. Be sure to leave the trailing brace } in the script.
    image
  4. To run, right click on the .ps1 file and click ‘Run with PowerShell’
  5. After testing the script manually, don’t forget to schedule it to run on a weekly or mothly basis.

Finally, from the FWIW department: you should know that from a security point of view,
deleting IIS log files or other similar system log files, is not generally recommended.

Not Enough Disk Space SBS 2008 Backup

My normal experience is that the built in backup for SBS 2008 generally just works … that is, until now. I returned from vacation to find backup errors on an SBS 2008 customer’s server. The error message was: “Failed – There is not enough space on the disk”

image

So, I hunted around for a solution to get things running, and here’s what I found that worked for me. What we will be doing is to manually delete the oldest shadow partition(s) from the USB drive, thus making room for newer backups. Here’s the process we will follow:

  1. Temporarily assign a drive letter to your USB drive being used for backup
  2. Use the DiskShadow utility to delete the oldest shadow partition(s) to free up enough disk space
  3. Remove the temporary drive letter assignment
  4. Rerun the backup

So, let’s get started:

  1. Open up Disk Management (Start –> Run –> DiskMgmt.msc)
  2. Right click on the USB Drive being used for backups, then click Change Drive Letter and Paths

    Remember: by default, the USB drive being used for SBS Backups is generally hidden.
    We can, however, assign a drive letter temporarily to make room on the drive.
  3. I mounted my USB drive to X:
    image

    Keep the disk Management window open, as you will be needing it.

  4. Next, open up a command prompt with administrator rights
    1. Type: diskshadow and press enter
    2. Type: delete shadows OLDEST x: and press enter
    3. Repeat the delete shadows command several time until you have freed up enough disk spac
    4. Then close the command prompt window
      image
  5. Return to the Disk Management window, click Change Drive Letter and Paths… and remove the drive letter assignment.
    Note: removing the drive letter may take a few minutes, so do not panic!
  6. Next, rerun your scheduled backup, and hopefully your backup will successfully complete!
    image

Finally, you will find some helpful information in this blog post from the Microsoft Storage Team on backups and space management for Windows Server 2008/2008R2.

Stop Java from installing other third party software

I don’t know about you, but I am tired of being tricked into installing additional third party software that I did not want.

Oracle’s Java is a prime example. It tries to get you to install their sponsors’ applications (Ask Toolbar, Yahoo Toolbar, McAfee,  Chrome, etc.) whenever you click to install the newest Java update. Yes, there’s a window that pops up allowing you to UNcheck those boxes, but come on … leave them unchecked by default, ad then let us decide if we want to install them.

image

I finally discovered a solution – there are registry settings that will block ANY of these sponsored applications from installing! I will give Oracle kudos for at least providing these registry settings, but it certainly is a hidden secret!

image

To make things easy, I put the two registry settings into a text file that you can download and install.

Please note that the download file has a .txt suffix, which will need to be changed to .reg before installing.

  1. Download file to your computer: disable-java-sponsors.txt
  2. Rename file to disable-java-sponsors.reg
  3. Double click on the file and it will update your Windows registry
    image

If you want to test that it really works:

  1. Uninstall your current version of Java
  2. Go to the Java web site and select to install it again.
  3. Voila, the sponsored application window doesn’t even appear!

For those with a Windows server, you can use group policy to implement this for all workstations!

Scheduling the WSUS Cleanup Wizard

I manage several SBS 2008 and SBS 2011 servers. One of the key maintenance issue is the size of the WSUS database. There are plenty of posts from people bemoaning the fact that suddenly the WSUS Content folder has grown to over 20gb (or more)!

WSUS provides an easy way to run the wizard manually. But doing this requires one to log into the server, and start up the wizard. Why do that, when you can schedule the wizard to run on a weekly basis?

Kudos to my good friend and fellow MVP’er, Kevin Royalty, for this information.

STEP 1 – Run the WSUS Cleanup Wizard manually

Before scheduling the wizard to run automatically, it is important to run the wizard manually first, especially if it has not been run in a long time. Do not be concerned if the wizard takes hours (literally) to run the first time. My fellow MVP’er, Philip Elder, blogged that he had one server required 36 hours to do the initial cleanup!!!

Review  my post for running the wizard manually.

image   image

 

STEP 2 – Create the WSUS Cleanup Batch file

  1. Go to the Codeplex site and download the WSUS Cleanup v2 tool (zip file)
    image     image
  2. Extract the files to your desired folder (C:\Scripts in my case). Three files are extracted.
    image     image
  3. You then need to create your own batch script/command, and documentation to do that is available from the Codeplex site
    – OR –
    Just download my script (WSUSCleanup.txt) and save it to your Scripts directory (be sure to rename it from WSUSCleanup.txt to WSUSCleanup.cmd)
    image

 

STEP 3 –  Schedule to run the batch file automatically

The only thing left is to schedule the task to run on a regular basis (perhaps weekly on Sunday mornings).

  1. Click Start –> Administrative Tools –> Task Scheduler
  2. Click Create Basic Task… from the right hand frame
  3. Type in a name (for example Weekly WSUS Cleanup)
  4. Click to run it weekly
  5. Click to run it every Sunday, and set your time (for example 9:00am)
  6. Click to ‘Start a program’
  7. Browse and locate your script (again, as a reminder, if you downloaded my script, be sure to rename the suffix from .txt to .cmd)
  8. Click to select (enable) the ‘Open the Properties dialog box …’ option, then click Finish.
  9. Click to select (enable) the ‘Run whether user is logged on or not’ option, then click OK
  10. You will be prompted to enter the appropriate user account information for running this task.
  11. I would suggest running the task immediately after creating it and monitor to make sure it runs successfully.
    image

Block IE10 from Installing

This is from the “wish I knew about this sooner…” department.

Microsoft released earlier this year the Internet Explorer 10 Blocker Toolkit for Windows (x86 and x64) and Windows 2008 R2 SP1. This patch does not pertain to networks that are running an update management tool, such as WSUS, that provides the ability to block IE10 from being rolled out.

For all other workstations, you can download and run this tool manually from each workstation. The tool is a .EXE file that contains three files to be extracted.

  1. Create or identify a temp folder to be used (e.g. c:\temp)
  2. Download and run the IE10 Blocker Toolkit.
  3. Click Yes and then select the temp folder from step 1 to extract the three files
    image
  4. Open up an elevated command prompt, and use the CD command to switch to the temp folder
  5. Type ie10_blocker.cmd  /B and press Enter to set the block for IE10.
    image
  6. Check that you receive “The operation completed successfully” message, and then close the command prompt window.

As a reminder, IE10 is only pushed out for Windows 7/2008R2 and above. So, there’s no need to run this command script on Windows XP or Vista or Windows Server 2003.

BSOD Utilities

Got a Blue Screen of Death? Want to know what caused it, so you can try to fix it?

Microsoft offers tools for reading dump files (KB 312563). But I have to admit, just trying to read through the steps necessary gives me a headache.

If you’re like me, you want a quick and easy process. If so, check out either of these two free utilities:

Both programs support Windows 32bit and 64bit operating systems, from XP through Win8, and Windows Servers (2003, 2008, 2012). Both versions come with a full install/uninstall executable.

I prefer NirSoft as it includes a zipped file version, that does not require any installation. So, I can access it directly from a USB drive or SkyDrive account. I can also use NirSoft to view mini-dump files of networked computers.

Resplendence free version is for home use only. Their PRO version ($35US) is required for business use, and to view dump files of networked computers.

Both companies offer other utilities which you may find useful for your environment.

image     image

Free Hyper-V 2012 Backup with Altaro

People are quickly discovering the benefits of implementing a Hyper-V server solution into their business. If you have been tentative about jumping, do so today!

I had an opportunity today to start exploring some of the 3rd party software solutions available for backing up Windows Server 2012 Hyper-V virtual machines (VMs). As I asked around for recommendations, several names kept coming up: Altaro, Storagecraft, Veeam.

image

As I was already familiar with Storagecraft and their ShadowProtect product, I decided to take a look at Altaro, primarily because I kept reading reviews about how easy it was to install and run, and because they offer a free version that will backup two VMs, forever, for FREE.

I like “easy” and “free”, and in less than ten minutes I had Altaro installed and backups scheduled and running. I also like the fact that these are hot backups, allowing you to back up running VMs without stopping them!

  • Go ahead and download the free edition here (installation file is less than 20MB in size). Installation was a breeze — five quick clicks of a mouse is all it takes! NOTE: you install Altaro on the Hyper-V host (parent), not the guest VMs.
  • Altaro supports Windows 2012 , and even creates some helpful tiles!
    image
  • Start up Altaro’s Management console, and it will automatically start scanning for any and all of your virtual machines.
  • All that was left was to select which VMs I wanted to backup, and then select an appropriate drive to store the backups. I had a 2TB USB drive available.
    Note: Altaro does not delete any existing files or folders on the selected backup drive. It creates a folder labeled ‘AltaroHyperVBackup’.
  • Here’s a screenshot of their dashboard.
    image

 

The free version, as I mentioned earlier, will backup two VMs forever. The free version does not include File Level Restore, and it will only allow you to restore backups made during the most recent four weeks.

For $345, you can back up up to 5 VMs, and for $445 you can back up an unlimited number of VMs.

View a comparison of the Altaro editions.

SBSMonitoring Database is nearing maximum size

Chances are, if you have an SBS 2008 server, it is running very well. But this may lead you to become complacent in managing the server. For example, it is important that you run the SBS 2008 Best Practices Analyzer on your server on a regular basis. Whether that is monthly, or quarterly, run it!

On a recent SBS 2008 server that has been chugging along quite nicely, I discovered that BPA had not been run in quite awhile. When I did, I was greeted with this warning:

The SBSMonitoring database is nearing maximum size
The SBSMonitoring database is currently 3762487296 bytes in size

image

Wow, that’s nice … except for the fact that the warning message doesn’t tell you what to do to fix it or clean it up. It doesn’t even point you to a KB article.

The rest of this blog post identifies three different solutions to this problem.

 

Solution 1: KB 981939

If you do your due diligence in searching the web, you will come across Microsoft KB 981939. You can read through the KB article for the details, and you may want to give it a try.

When you run their PowerShell script, you may get an error about the execution of scripts. If so, simply type the following command at the PS> prompt:

Set-executionpolicy remotesigned and press Enter

But, wait — there’s a second solution!

 

Solution 2: Replace SBSMonitoring Database

If solution 1 fails, and you go back to search the Internet, you will discover a blog post from Third Tier titled: SBS 2008 Monitoring Database Fills to Capacity.

This solution has you replacing the current SBSMonitoring database with a new clean one. Only one problem: how many people keep a clean copy of their Monitoring database around???

No problem, there’s a third solution, which is the best!

 

Solution 3: Recreate the SBSMonitoring Database

Check out the SBS Blog site for How to Recreate the SBSMonitoring Database.

Simply download the provided zip file, extract the PowerShell script, start up an administrative PowerShell session, and run the script. Voila! It’s finished almost immediately.

image

All that is left is to rerun the BPA and verify that the warning message no longer appears!

Cheers!

SBS and Essentials Build Docs

For several years the SBS MVP’s have been maintaining several Wiki-type “build” documents for the SBS and Essential server platforms, including SBS 2008, SBS 2011 Standard/Essentials, Windows 2012 Essentials and Storage Server 2008 R2 Essentials!

image

These documents contain a wealth of real-world and time-tested hints and recommendations, collected from MVPs around the world. They contain information you need to know before, during, and after installing SBS or Essentials.

This link below will take you to the main page with links to each individual build document.

http://social.technet.microsoft.com/wiki/contents/articles/1710.small-business-server-documentation.aspx

Enjoy!

Extend Keyboard and Mouse with Synergy

Last August I wrote about a utility called Mouse Without Borders, developed in Microsoft’s “The Garage”, that allows you to use one keyboard and mouse to control multiple computers. And the utility works very great.

That is, unless you also have Linux or Mac OS X computers which you also want to control with a single keyboard and mouse.

So, here comes Synergy which offers to extend your mouse and keyboard to all three environments. And did I say that it is FREE??

image

I decided to take it for a spin today, and I was quite surprised at how easy it was to install and run it. For this first effort, I only installed it on two Windows computers. At a later date I will post my efforts to include a Linux or Mac workstation.

My scenario: I have a Windows 7 x86 workstation with three monitors, and a Windows 2008R2 x64 server, running Hyper-V.

INSTALL/SETUP FIRST WORKSTATION

My mouse and keyboard that I wish to use is on my Win7 workstation. So I first downloaded the Windows 32-bit version of Synergy and installed it. I designate this as my Synergy “server”.

image

It then asks what type on encryption I wish to use. That’s a really nice feature as it does provide some protection from anyone trying to intercept your keystrokes. You have a choice of four (4) different encryption modes, or you can disable encryption. For purposes of testing, I chose to not enable encryption.

image   image

The only other step to do is to click on the Configure Server… button. You will have a screen where you can describe your setup, indicating in which direction the monitor for each of the other workstation(s) is located.

image   image   image

 

INSTALL/SETUP ON NEXT WORKSTATION

In this case, my second workstation (which Synergy refers to as a client) is running Windows Server 2008 R2 x64. I am also running Hyper-V manager on this server, so I decided to install the Synergy client to the Hyper-V parent, so I can control all of my Hyper-V guests.

So I download and install the 64 bit version of Synergy, and install it. This time, when it asks Server or Client, I’ll select “Client”. Then you need to tell the Synergy client the name of the computer that is the “Synergy “server”.

image   image

I thought I was all done, but my mouse would not move over to the monitor attached to my server. At first I thought it was a firewall issue, but turning off the firewall on the W2K8R2 server did not fix it. In fact, if you check the firewall settings, you will find that Synergy had automatically added the proper Inbound TCP and UDP rules.

image

I then checked Services, and discovered that the Synergy service had not yet been started.

image

After doing so, I immediately saw that Synergy was communicating between the two computers, and my single mouse and keyboard was now controlling both computers!

image