Master & Cmd-R

XCloner: Using Cron to automate your backups

XCloner has quickly become my backup plugin of choice for Joomla websites, and it works very well for WordPress as well – It’s saved my but more than once, and it’s great for doing site migrations (hence the word “Cloner”). Here’s the procedure for installing and configuring it, with an added dose of Cron loving at the end:

Download and Install:

  • Click on the logo to go to their downloads page:

clip_image001

  • Download the latest version for either WordPress or Joomla:

clip_image002

  • Log into your Joomla or WordPress control panel and install the plugin:

clip_image003

  • Once you have it installed, head over to Components to configure it:

clip_image004

  • Your first task is to change the password from the default:

clip_image005

  • Click Settings:

clip_image006

  • Click on Authentication, then change the password to something else (make sure you document what the password is)

clip_image007

  • Click Save:

clip_image008

  • Now, if you go back to the main screen, all the settings are green (Authentication stays red until you change the default password):

clip_image009
Go ahead and click on Generate Backup: I normally just leave the default options in place (backup databases, backup files, automatically generate a name)

  • Click Continue to start your backup running:

clip_image010

  • It takes a few minutes to run the magic:

SNAGHTML4581d17

  • Once the backup completes it’ll give you the details of what it’s done, and the backup file name: Click Close

SNAGHTML458de73

  • If you go back to the main screen, and click on View Backups you can download the backup from there, or restore from it, or check when your last backup was done. You can also use the backup file to migrate a site from one host to the other – it’s a complete clone.

SNAGHTML459766d

Automate your backups with Cron

  • You can also set this up as a Cron job for automated backup magic – go to Configuration – Cron

clip_image014

  • The only setting I found I needed to change was to have it Delete Old Backups:

clip_image015
For everything else, just leave all the defaults and click Save.

  • Go back to the Cron Command Setup and grab this script:

SNAGHTML45b591e
Copy the script, and add on an email command at the end so you get notified when the job is complete: | mail -s “Website Backup Task” myemail@mydomain.com

And add it to the Cron jobs in your CPanel – If you have MySQL maintenance tasks set up, then you might want to consider setting it to run on a different day or time, so that your webhost doesn’t get too hammered for the entire 2.5 minutes that it takes to run these tasks. It’s probably not an issue, but if you have multiple websites hosted on your account, the host can sometimes get a bit twitchy if there’s too much happening at once, and shut you down.
SNAGHTML461adc2
Sit back and enjoy the magic!

LogMeIn Host Preference Packages

We’ve been having an issue with LogMeIn crashing when we connect to a remote computer – LogMeIn gave me an option to try, and then showed me a neat trick to apply it to all our servers at once. Rather than going to the preferences for each server individually, you can create a Host Preference Package and apply it globally, or to individual groups or computers.

 

Here’s how you create or edit the preference packages

Open LogMeIn Central, and click on Host Preferences:

image

Click on Add Package, or select one of the existing packages to edit it.

clip_image003

If you’re creating a new preference package, give it a name here:

clip_image004

From here on, the options will be the same if you are creating a new profile, or editing an existing one.

Click on the Category drop-down box:

clip_image005

There are three general settings I apply, and they’re under Network, Log Settings and Remote Control.

clip_image006

Under Network, I set the auto-update option so that the client stays up-to-date automatically:

clip_image007

Under Log Settings, I turn on debug-level logging: (This helps LogMeIn support immensely when it comes to troubleshooting)

clip_image008

Under Remote Control, I’m unchecking the option to disable wallpaper (this was the fix for BG Info crashing that I blogged about earlier):

clip_image009

Make sure you click Save at the bottom of each screen, and then when you’re done editing everything, click Finish and Save All.

clip_image011

The final step is to Assign it the computers you want it on – note that with this system, you can create different preference packages, and assign it to whichever computers you want. You can only apply these packages to computers that are on a Pro account – Free users need not apply:

clip_image012

Select all the computers you want to add from the list, and then hit the arrow to assign them to the group. Click Save when you’re done – your settings have now been applied to all the selected computers at once. This was a huge time saver, and a great way to make sure you have the same settings on all your remote computers.

Excel slow to open network files

We ran into an issue with Excel files taking a long time to open from a network location after Trend 8 was installed – the issue has something to do with the way Trend scans files before it allows them to open. One of the indicators of this problem was that when you open a spreadsheet off the server, we’d see three dialogue steps in the progress bar:

Contacting filename.xls…
Downloading filename.xls…
Opening filename.xls…

With a progress indicator beside each step, almost as if there’s a delay forcing a download of the file. When Trend is disabled, the file opens immediately – at least, the steps happen so fast that we don’t see them at all.

 

The fix that was recommended by Trend support worked for this situation:

  • Open the ofscan.ini share on the server where Trend is installed.

clip_image001

  • Find AvoidExcelSaveIssue in ofcscan.ini, and change it to 0.

clip_image002

  • Logon the web console, and go to Global settings. Click on “Save” without doing any change. This will push the AvoidExcelSaveIssue setting to client.

clip_image003

  • Wait for 5 minutes for the setting to deploy.
  • To verify if the setting was applied:

Open the registry and go to

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesTmFilterParameters

Verify that the REG_DWORD —> AvoidExcelSaveIssue = 0 is in place
Reboot machine to apply the settings – you should be good to go after the reboot. Of course, your mileage may vary

QNAP Offline?

Most of our clients use QNAP devices with Backup Exec – they’re amazing devices, and we love to use them. We ran into an interesting issue in the last few days, though (right after the switch from Daylight Savings Time)… we found that some of our client’s backups were failing in Backup Exec, and that the QNAP would show as being offline. And surprisingly, after flicking the switch in Backup Exec to bring it online again, it would immediately go right back to being offline.

 

Another clue to the strangeness of this problem is that if you tried to connect to it by UNC patch it would give an error about the server being misconfigured – all in all, it was acting bizarre.

 

Well, turns out the problem was a timing one – if you log onto the QNAP and select General Settings:

 

image

 

 

And then Date and Time:

image

 

You might find (as we did) that your beloved QNAP did not make the time change with your servers, or maybe that it has just fallen out of touch by more than a few minutes – which can be enough to make things fall over.

image

 

As this screenshot shows – make sure your time settings are accurate, and then make sure to set the time to synchronize automatically – either to an internet time server, or to your local Domain Controller (like what we have here). We found the time interval was set to 7 days, but a good idea would be to bump that up to a happy medium like once per day – that way your QNAP doesn’t wait a week to bring itself back on track again, and your backups don’t fail on you.

Once you get your time sorted out, you should be able to bring it online again in Backup Exec and start pushing backups out to it again.

Hope this helps… Good luck and have fun!

Exclaimer Outlook Photos

Outlook Photos by Exclaimer is a great (free!) utility for adding photos to your Exchange users and distribution groups, allowing you to put faces to names and greatly improving the social aspects that Outlook 2010 has built in (It’s also a great way of super-imposing mustaches on all your users in preparation for Movember :D).

Start by downloading the program from their website and installing it on your system. You can install it on any computer on the domain, as it will ask you where your AD is, and scan it remotely – you don’t need to install it on your server.

There are several ways to go about getting the users who need photos – you can either tell Outlook Photos to scan the entire Active Directory to find users that need photos:

image

Or you can point at a folder of photos that you’ve got prepared and let Outlook Photos match them up:

image

If you’re going to be using this option, make sure you name all your images with the correct names of the users you want to update. OP will scan through your AD and match the file names to the names of people it finds, and then ask you to manually assign any names it can’t find a match for.

 

Also, you can refine your search to a specific OU by clicking the Scan AD button:

image

 

Once you click it, a window will pop up where you can select the container that you want to search:

SNAGHTMLab1aa5a

 

If you have multiple Domain Controllers, a warning will pop up in the ribbon recommending you select a specific DC to make the changes on:

image

 

Go ahead and choose a DC, and click OK for it to search the container and show you all the users that need / have pictures associated with their profile (based on your choice of what it should display):

SNAGHTMLab26d0c

 

Once you’ve found the user or users that you want to update, double click on them in the list and select Choose Picture:

SNAGHTMLab2a857

 

Browse for the picture that you want to replace it with and click Update: note that whatever size image you choose, it will be adjusted to 96×96 pixels, so you might want to start with them at that size if you don’t want scaling silliness to ensue.

SNAGHTMLab33cd8

 

After putting your admin password in, the thumbnailPhoto field is now populated – rinse and repeat until you’ve got all your users updated.

SNAGHTMLab36752

 

One important thing to remember is that these changes won’t show up automatically, as Outlook will only sync the Global Address List once per day – if you want to force the changes sooner in order to see the magic that you have just created, open Outlook and click Send /Receive – Send/Receive Groups – then Download Address Book…

image

Enjoy!

Using Cron to automate MySQL maintenance

We recently needed to go through a list of around 50 sites that we host through HostGator and optimize all of their MySQL databases. Going through each one and optimizing the database tables manually was a very unappealing process, so my trusty compatriot Keith worked out a process to use Cron jobs to automate the procedure. It took a bit of tweaking to get the right arguments in place, and a lot of looking around on the internet to fix a problem with conflicting arguments in the script, but in the end we triumphed… and man, is it awesome!

 

This is taken in the context of our site hosting in HostGator, but the process will be similar (or the same) for any site that uses CPanel.

 

First, log into your CPanel and look for the Cron jobs icon:

clip_image001

 

Update the email address that you want your Cron job to go to: in this case, we’re specifying the output, but it never hurts to have this set for any future jobs you want to run that don’t need to have a specific email output configuration. (more on this in a bit).

clip_image002

 

The next section is where you create your Cron job – in order to test and make sure everything is working, create a new job to run every 15 minutes. What, you don’t believe in testing scripts before releasing them into the wild? I… I don’t even know you any more!

image

 

Paste the following code into the command section:

mysqlcheck -u root -ppassword --auto-repair --optimize --all-databases 2>&1 | mail -s "MySQL Database Optimization" myemail

 

And click on the Add New Cron Job button

image

 

*Replace root with your username and password with your password – note that while there is a space between the –u and your username, there is no space between –p and your password, and (most importantly), there are two dashes on the auto-repair, optimize, and all-databases switches. Also replace myemail with the email address that you’d like to have the results sent to (myemail@domain.com).

 

Here’s what the individual sections mean:

mysqlcheck –u root –ppassword --auto-repair --optimize –all-databases

 

This section is pretty straightforward – runs a check on all your databases and repairs and optimizes them. If you’d like to run this against a single database, change —all databases to db_name or —databases [database1 database2] and so on.

 

2>&1 | mail -s "MySQL Database Optimization" myemail

 

This is the bit that outputs to an email address that you specify, and allows you to specify a subject for your email. If you leave this option off entirely, it will send an email upon completion to the email that you specified earlier, but it will dump the entire script into the subject line of your email, which includes your username and password – yikes!

 

If you’d like to not have an email sent at all, add this section right after all-databases:

>/dev/null 2>&1

 

Your new job will show up immediately below, and should look like this:

image

 

Once you’ve received a confirmation email, and everything is working – simply go back and create a new job that runs on whatever schedule you’d like – in our case, we chose the 1st and the 15th of every month, but you can use any timeframe you’d like.

image

image

 

Delete your test job, and you’re all set to go!

image

How to install & configure PDF iFilter for SharePoint Server 2010

This is something we do as a part of every SharePoint Server 2010 install – we have been unable to find any reliable instructions on how to do this, and this works for us every time.

Follow the steps below to install and configure PDF iFilter on SharePoint Server 2010:

  • Install PDF iFilter 9.0 (64 bit) from here.
  • Download the following PDF icon file:
Right click and “Save As”

And save it to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES\

  • Next you need to edit your docIcon.xml file so that PDF files will use that icon. Navigate to

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML\docIcon.xml
and add the following line:

<Mapping Key=”pdf” Value=”pdf16.gif” OpenControl= />

**Adding the OpenControl=”” option at the end of this line fixes a problem with SharePoint prompting you to open a PDF as Read-Only or Edit – thanks to David Kvas for his post on this!

A couple of things to note:

  • Be careful you don’t introduce rogue ascii characters (don’t copy and paste from the web page into the file without making sure the formatting has been removed). A good safe bet is to simply copy a similar line from where you plan to put the new line and make your changes that way.
  • Also, because this is an XML file, don’t just plunk this line at the top or the bottom of the file, it needs to go in the <ByExtension></ByExtension> section. Again, a good idea would be simply to find that section, and work your way down the list (it’s alphabetical) and insert the line in its proper order. That way you can be sure you haven’t put it outside of its XML tags – which can cause all kinds of issues (Application broken because of an extra character in your code that you can’t see no matter how hard you look? *raises hand*)

* Note: If the file is locked and you’re unable to save your changes, perform a quick IISRESET to take care of that – be careful not to interrupt your users.

  • Next, open the registry and navigate to the following location:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\14.0\Search\Setup\ContentIndexCommon\Filters\Extension

  • Right-click Extension, then click NewKey:


  • Name the Key .pdf


  • Now add the following GUID in the default value as shown in the figure below.
     

    {E8978DA6-047F-4E3D-9C78-CDBE46041603}


  • Open SharePoint Central Admin, and click on Manage Service Applications


  • Click on your Search Service Application:


  • Select File Types from the Crawling Menu on the left:


  • Select New File Type:


  • And type pdf into the File extension box, and click OK:


  • Once you click OK, it will take you back to the previous screen where you will now see the PDF file type showing up with the icon that you specified earlier in the first phase of this process:


    * Note: if the icon doesn’t show up immediately, you’ll need to do an IISRESET to reflect the changes you made to the docIcon.xml

  • Then restart the SharePoint Server Search 14 service as shown in the figure below:

    (Start-Run-services.msc, in case you forgot)


Finally, perform a fresh crawl of your site(s) to update the index and start showing PDFs – a full crawl is ideal, but if server resources are a concern, perform an incremental crawl at the very least.

  • To get a crawl running, go back into SharePoint Admin, and click on Content Sources under Crawling:


  • Selecting Start all crawls from this menu will perform a full crawl on all content sources:


    If you want to run an incremental crawl (or a full on specific sites) select that site’s drop down menu and choose Start Full Crawl or Start Incremental Crawl. Note that if you have chosen to run an incremental crawl because of time constraints or server load, you’ll need to select each site in your list and start an incremental crawl from the drop-down menu.


Friends don’t let friends use Claims Based Authentication

How to recognize if your site admin is using (claims based authentication)

Claims Based Authentication

* Thanks to Joris Poelmans’ slideshow: Claim Based Authentication in SharePoint 2010 for Community Day 2011,

This one’s pretty easy – as soon as you enable claims based authentication in SharePoint 2010, it attaches a coded ID to all the usernames that looks like this: i:0#.w|contosousername. This coded ID looks like a weird error to the uninitiated, but not to you – oh no! You know what it all means and are able to decrypt it using the following handy dandy decoder ring:

Take it easy, man… claims are fun!

From what I’ve been able to learn about it, claims based authentication has some interesting possibilities that make it worth exploring, but has a few major gotchas. For instance, once you’ve transitioned to claims based authentication, it’s a one way street – there’s no going back.

* http://msdn.microsoft.com/en-us/library/ff953202.aspx

Basically, as with any technology changes, if it’s set up properly it has a lot of new and shiny things that you can do – if set up incorrectly, it will cause a lot of headaches and will have you either blowing your application away and re-creating it, or restoring from your latest backup.

BGInfo errors in LogMeIn?

We’ve started seeing this error message on quite a few of the servers that we log into remotely – given that the error message talks about permissions and group policy, I started looking in that direction trying to find what had changed. The problem turned out to have nothing to do with group policy or user rights, but a setting in LogMeIn!
When you log into a server through LogMeIn, you get this error message:



I have verified that the problem occurs on a server through LogMeIn, but connecting to that same server with RDP will not throw up an error, and BGInfo fires just fine.
Thankfully, the fix is simple: Once you have the server selected, click on Preferences, then General:


Under the Remote Control option, uncheck the box to Disable wallpaper and user interface effects on host computer.

Hit Apply, and then go back to Remote Control and remind LogMeIn and BGInfo that yes, I am Yo’ Daddy!

 


Removing uninstalled (missing) devices in Device Manager

Thanks to Rob for this great tip – I had no idea this was possible, so hopefully there’s others out there who will find this useful!

When you physically uninstall a device in Windows, the device drivers are often not uninstalled and will remain in your Device Manager, even though it’s no longer visible. Removing the drivers for these ghosted devices can clear up a lot of weird issues caused by driver conflicts, or more importantly, prevent issues from occurring in the first place.

Up to this point, my standard procedure to remove these old drivers was to reboot the machine in Safe Mode, which allows you to see all devices and drivers installed on the machine, even if they’re no longer present. This of course has the downside of taking extra time, as you now need to reboot to get into Safe Mode, and then reboot one more time to get back out again. And with servers being what they are, this can sometimes add as much as half an hour to what is probably a fairly simple hardware upgrade.

Here it is…

Your first step is to open up a command prompt, and type in the following:

2-17-2012-9-34-19-AM-1.png

Starting the Device Manager from this command prompt is essential, as the command to show the missing devices only does it for that instance – if you leave this command prompt to open Device Manager it won’t show them!

Once Device Manager is open, click on View-Show hidden devices. In this case, we’re going to be removing an uninstalled Network adapter, so the only one that’s showing in the screenshot below is the one that is currently installed.

image.png

Voila! Along with some other hidden devices, we find the network adapters that were uninstalled.

image.png

(This is what Show hidden devices looks like if you haven’t run the command, or if you’ve mistakenly opened your Device Manager a different way – not from the command prompt. Note that while we can see the standard hidden adapters, we don’t see the ghosted ones like we do above.)

image.png

Now that we can see our ghosted devices, it’s a simple matter of right clicking on the device and uninstalling it:

image.png

Click OK  to confirm:

image.png

 

And you’re done! No need to worry about running another command to reverse this, because as soon as you close Device Manager it resets to its defaults of not showing ghosted devices.