Wednesday, 30 September 2015

Sage Payroll Trying to Update instead of Install - Looking for Payroll Module - Updated for v29 2023

I recently had a PC which had Sage Payroll installed but then removed. A new copy had been downloaded and whenever it was ran it tried to update instead of install.

It seems that the payroll installer seems to think that its still present, so instead of starting the installer it starts the update and eventually crashes out.

to sort this, you need to remove a few left over files/folders from when the software was uninstalled.

Firstly, go to the program files and program files (x86) folders on your main drive (if present) and look for the sage payroll folder - if you find it, remove it.

Secondly, do the same in your program data folder - find and remove the sage payroll folder (not accounts!)

Finally, look in c:\windows\ for a payroll.ini file - also remove ths

And that's it, the installer will now run instead of the updates.

Thursday, 13 August 2015

Windows 10 Wireless missing 5GHZ networks (TL-WDN3200 N600 TP-LINK)

After upgrading to Windows 10 on my home PC, I realised that it was no longer able to connect to my 5ghz network using my TL-WDN3200 dongle. The wireless network list didn't even display it.

On further investigation i decided it must be a driver issue, so i went over to the TP-LINK website and downloaded the latest driver set (for Windows 8.1 x64 as at the time of writing there were no Windows 10 drivers available). I installed the drivers, but the network still didn't appear.

Upon closer inspection I identified that the USB dongles chipset maker was Mediatek, so I headed off to their website and downloaded their drivers.

Straight after installing, I had access to my 5ghz network again. Must be a bug or inconsistency with the tp-link/builtin/windows 10 drivers

The URL for the mediatek drivers is: http://www.mediatek.com/en/downloads1/downloads/usb/

-- Update April 2016 --

TP-Link still haven't got this sorted yet and there are lots of complaints about it on their forums. They have released a Windows 10 compatibility list here: http://www.tp-link.com/en/article-15587.html but it doesn't look like the WDN3200 is going to get a new driver in the near future!

Tuesday, 4 August 2015

Windows 10 upgrade - setup has failed to initialize the working directory

I recently updated a ASUS Transformer tab to Windows 10 but during the update process recieved the following message:

setup has failed to initialize the working directory

After looking into the problem, I was able to determine that it was related to the amount of free space on the drive (the Transformer only has a 32gb SSD and I had less than 7GB free)

I cleared some space (just over 10GB) and re-ran the update without issue

Hope it helps someone

Update: 
When you do finally get past this error, if you don't have over 10GB free the update will ask you to either free up more space or plug in an external USB HDD - which is what I did to get around this. Once the update was complete and you definitely didn't need to rollback you can wipe the external.

Friday, 3 July 2015

Error with PHP mail(): Multiple or malformed newlines found in additional_header

A new update for PHP has broken a few mailing scripts that a few of our clients use (https://bugs.php.net/bug.php?id=68776)

More specifically, the script sends an email with an attachment - I wrote these using some guides from other sites however it now appears that i've been ill advised as its not technically the correct way to do it.

Original (now broken code) below:

function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
    $file = $path.$filename;
    $file_size = filesize($file);
    $handle = fopen($file, "r");
    $content = fread($handle, $file_size);
    fclose($handle);
    $content = chunk_split(base64_encode($content));
    $uid = md5(uniqid(time()));
    $name = basename($file);
    $header = "From: ".$from_name." <".$from_mail.">\r\n";
    $header .= "Reply-To: ".$replyto."\r\n";
    $header .= "MIME-Version: 1.0\r\n";
    $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
    $header .= "This is a multi-part message in MIME format.\r\n";
    $header .= "--".$uid."\r\n";
    $header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
    $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
    $header .= $message."\r\n\r\n";
    $header .= "--".$uid."\r\n";
    $header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n";
    $header .= "Content-Transfer-Encoding: base64\r\n";
    $header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
    $header .= $content."\r\n\r\n";
    $header .= "--".$uid."--";
error_reporting(E_ALL);
    if (mail($mailto, $subject, "", $header)) {
        echo "Mail Sent Successfully to " . $mailto ."<br/>"; // or use booleans here
    } else {
        echo "Mail NOT Sent to " .$mailto ."<br/>";
    }

There are now more checks on the header field, which means data which was being stuffed into the header should now really be in the message. See the changes I made to get this working with our webservers (highlighted in yellow):

function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
    $file = $path.$filename;
    $file_size = filesize($file);
    $handle = fopen($file, "r");
    $content = fread($handle, $file_size);
    fclose($handle);
    $content = chunk_split(base64_encode($content));
    $uid = md5(uniqid(time()));
    $name = basename($file);
    $header = "From: ".$from_name." <".$from_mail.">\r\n";
    $header .= "Reply-To: ".$replyto."\r\n";
    $header .= "MIME-Version: 1.0\r\n";
    $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
(THIS ENTIRE LINE HAS BEEN REMOVED)
    $nmessage = "--".$uid."\r\n";
    $nmessage .= "Content-type:text/plain; charset=iso-8859-1\r\n";
    $nmessage .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
    $nmessage .= $message."\r\n\r\n";
    $nmessage .= "--".$uid."\r\n";
    $nmessage .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; 
    $nmessage .= "Content-Transfer-Encoding: base64\r\n";
    $nmessage .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
    $nmessage .= $content."\r\n\r\n";
    $nmessage .= "--".$uid."--";
error_reporting(E_ALL);
    if (mail($mailto, $subject, $nmessage, $header)) {
        echo "Mail Sent Successfully to " . $mailto ."<br/>"; // or use booleans here
    } else {
        echo "Mail NOT Sent to " .$mailto ."<br/>";
    }

}

And that sorted it out - I hope this helps someone as I had a hell of a time trying to work out what the error message meant and its been pretty vague. Add to this the comments on the PHP bug fix page which aren't that helpful and its quite difficult to sort out. Please +1/share this if it helps you so it can help others

Tuesday, 30 June 2015

PHP mysqli slow running/loading SQL statements

I've recently been working on a new system for a client - the last time that I did this I created my own object oriented implementation of the old MySQL function.

MySQL has since been superseded, and something similar to what I created is now part of PHP - called mysqli its one of two new interfaces that come as standard with PHP to run SQL scripts.

I've been making the system for a number of weeks now and performance has always been a little lackluster. Today, I decided to spend some time trying to optimize things and for the life of me I couldn't work out why running 5 SQL commands was taking over 8 seconds!

Loads of digging later, I've now managed to get the loading times to less than a second and I only needed to change one thing.

As an example, lets say my original connection string was:

$mysqli = mysqli_connect('localhost', $SQL_Username, $SQL_Password, $SQL_Database);

Well for some reason, my web-server didn't like using the DNS hostname of "localhost" and simply changing this to 127.0.0.1 (local loopback) solved all my speed issues.

$mysqli = mysqli_connect('127.0.0.1', $SQL_Username, $SQL_Password, $SQL_Database);

It certainly helped me - hopefully it'll help someone else out there

Cheers

Thursday, 21 May 2015

A Volume Shadow Copy Service operation failed. Detailed error: The volume shadow copy operation failed with error code 0x800423f0

Windows Small Business Server 2011 randomly started to fail backups.

Backup console shows the following error:
A Volume Shadow Copy Service operation failed. Detailed error: The volume shadow copy operation failed with error code 0x800423f0

First things first, run a "vssadmin list writers" from a elevated command prompt. Output shows this to the be the faulty writer:

Writer name: 'SPSearch4 VSS Writer'
Writer Id: {35500004-0201-0000-0000-000000000000}
Writer Instance Id: {2f53b890-9998-4a18-8859-a5b70b3a56a3}
State: [8] Failed
Last error: Inconsistent shadow copy

This is usually a sign that Sharepoint needs updating (guide here) but upon running the "(get-spserver $env:computername).NeedsUpgrade" in the sharepoint shell I relieve:

(get-spserver $env:computername).NeedsUpgrade 

False

OK, not a sharepoint upgrade then! 

I check the services - all are running. For good measure I restart all the sharepoint services one at a time:

SharePoint 2010 Administration
SharePoint 2010 Timer
SharePoint 2010 Tracing
SharePoint 2010 VSS Writer (this is probably the only one that needed restarting)
SharePoint Foundation Search V4

I also restart the sharepoint SQL service
SQL Server (SHAREPOINT)

Re-run the backup job and voila - working.

A server reboot would probably have done the same.. but my clients don't like reboots during working hours

Thursday, 14 May 2015

Windows 8.1 not connecting to domain controller on login

I had a interesting problem recently where a Windows 8 laptop connected to a domain over wireless would login, but then not load the profile as it couldn't authenticate with the domain controller. It would instead, pop up with a username and password box, which if you entered the users details again would sometimes connect and work and other times not.

Very strange, as the system was connected to the wireless without issue and I could ping the server and do everything would expect.

On close examination, i discovered that the wireless network had manged to get itself changed from a "domain" category to a "private".

In the network and sharing center I was unable to change it from a public back to domain so I resorted to using the registry.

The keys are located in:

HKLM\Software\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles

Each folder in the profile key is a different connection - click on them and look for the one called "Category".

The category field defines the connection type:

0 = public
1 = private
2 = domain

I changed it back to a 2 and reboot the laptop - and everything started working again. This solved the problem for 2 days, whereupon the connected then changed to a private network and the same issue occurred again.

This time, i used the wireless network list to forget the network totally and then reconnect from scratch. The system picked it up as a domain connect immediately and this seems to have solved the problem since.

A new one on me :)

Update:
the problem came back! And on further investigation I discovered that the client had managed to re-enable DHCP on their router (instead of their server). This was causing the laptop to automatically go into "public" profile mode. Disabled DHCP on the router and the issue went away. Guess I should have looked at the problem in more detail

Thursday, 30 April 2015

Wordpress Nimbus Business Theme not displaying Page Content or excerpt under the featured pages

I've recently been using a different set of Wordpress Themes and one that I quite like it by Nimbus. (http://www.nimbusthemes.com/free/business/)

Sadly, the theme doesn't actually work out of the bag - and it seems to be down to shoddy coding (sorry guys, I even found the post you made on the wordpress site to have it featured and even they told you it wasn't working!)

It seems to be because when they load page content, it doesn't check if there's anything and then continue to load.

To fix, do the following:

1: Navigate to the following file:
themes\business-theme\page.php

Find the following line:

<?php the_content(); ?>

Delete the whole line and replace with:

 <?php if (have_posts()) : while (have_posts()) : the_post();
the_content();
endwhile; endif; ?>

And that should fix it

The excerpt bug seems to be something to do with a function called "chop_text" which doesn't seem to work properly. Rather than debugging why, I changed it to the built in wordpress function - wp_trim_words (why did they bother remaking it?)

Load the following page:

themes\business-theme\parts\frontpage-4boxes.php

Delete this:

 if (is_home()) {
            $content = chop_string(get_post_field( 'post_content', get_option( 'page_for_posts' ) ));
        } else {
            $content = chop_string($post->post_content);
        }

Replace with:

 if (is_home()) {
            $content = chop_string(get_post_field( 'post_content', get_option( 'page_for_posts' ) ));
        } else {
            $content = chop_string($post->post_content);
        }

Problem solved

considering this is the free demo it doesn't bode well.

But then it is a nice theme :) A very specific set of fixes but perhaps it will help someone - remember to +1 me if it does!

Friday, 10 April 2015

Slow HP Envy Laptop - High spec but very slow/sluggish performance

I've had a few clients come to me with HP Envy laptops that they have purchased in the past - and I started to realize that they were all complaining about the same thing: performance

The laptops themselves are pretty good specs - Intel i5/i7 8GB RAM and even a GT740M graphics card. CPU and memory usage looks good, but just using it for average tasks eventually slows it down to a crawl.

What gives? These are good laptops - certainly not cheap entry level units

Simple answer - the HDDs in them suck. 

All the laptops that had these problem had one thing a common : a HGST 1TB 5400RPM disk

I have to wonder why HP are selling such laptops with a low spec drive? The easy solution was to replace the drive with an SSD. Thankfully, replacing the drive in these units is very easy - you only need to remove a single screw.

Perhaps quite obvious, but you wouldn't expect a laptop of this level to come with a drive such as this. 

Below - one of the offending drives!



Wednesday, 8 April 2015

Help for setting up a btnet leased line with a Cisco 2921 and FSP150CP

I recently helped a client who had a btnet leased line installed - BT turned up to the property, installed a Cisco 2921 router connected to a FSP150CP showed the client it was working with their laptop and promptly left with a few notes as to IP address and mask.

The client was a little confused to say the least! I was asked to help - and many other people may find themselves in a similar situation.

Firstly, you will need a few things:

  • IPv4 Network Address (You should have been sent this in advance, if not ask the engineer installing)
  • IPv4 Network Mask (same as above)
  • Something to take care of NAT and act as a firewall (we used a Draytek Vigor 2830)
To work out your range of external IPs, you can use your network address and mask with a subnet calculator (such as http://www.subnet-calculator.com/)

The following has been created using the following IP addresses - you will need to enter your own instead for this to work! Be sure to change them and use the subnet calculator above if you need your entire range.

If our Network address is: 81.14.198.192 and our mask is 255.255.255.248 then our range is: 81.14.198.193 - 81.14.198.198 (to work this out, enter the address and select the mask on the calculator - the bottom then gives you the range)

In this instance, BT put their Gateway device on 81.14.198.193 (the first available IP from the available range) therefore you have 194 to 198 as external IP addresses to use.

So how do you get your kit working?

Get your firewall/router and plug a cable from the GE 0/1 port on the Cisco into the "WAN" port on your router. Ensure that this is a WAN port that takes a network cable and not a telephone one, as this is for ADSL or VDSL.

Now login to your own router, and set it a static IP address for Internet Access. The routers IP can be any of the addresses from 81.14.198.194 to 81.14.198.198. Enter the subnet address as: 255.255.255.248 and the Gateway address as 81.14.198.193.

And that should be it - there are a lot more things that can be done but these are the basics to get things working.

I hope it helps someone


On a more personal note, I did all of the above correctly for my latest setup of this equipment but couldn't get any data to move in or out of the router. Long story short, BT managed to assign the gateway device (The Cisco) with the range IP instead of the first available IP address! After a few calls to BT it was sorted and everything magically started working.

Tuesday, 17 March 2015

How to E-Mail backup notifications for Windows Backup

I love SBS - but we occasionally get a server that doesn't use it but we will still want to use Windows Backup. I hate not having reports, therefore we came up with the following alternative for emailing backup success events:

It utilities a third party mail sending tool which you can specify remote email servers and authentication parameters 

http://caspian.dotconf.net/menu/Software/SendEmail/
http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v156.zip

1: Setup your backup job and successfully run it at least once
2: Go to your event viewer and then "application and services logs"
3: Enter the "Microsoft" folder and then "Windows", "Backup" and select "Operational"
4: Find the successful backup log (It should have an event ID of 4) and then right click on it and select "Attach a task to this event"
5: Name the event (I leave it as the default name) and click "Next"
6: Because we're tying the task to an event the information will already by filled in for the second section, so click "next" again
7: On the action page, select "Start a program" and click "Next"
8: Extract the Send Email application at the top of this post to somewhere on the server and then browse to it and select it as the program to launch.
9: In the "Add Arguments" box enter the following details:
-f fromaddress@somewhere.co.uk -t toaddress@somewhereelse.co.uk -u FromName -m EmailSubject -s your.mailserver.co.uk -xu mailserveruser -xp mailserverpassword

Be sure to change the above for real values, a breakdown of the options are:

-f from address
-t to address
-u from name
-m email subject
-s mailserver
-xu mailserver username
-xp mailserver password

10: Click "Next" and then "Finish"

Your event task is now created - if you go to the task scheduler and select "Event Viewer Tasks" you should able to see it in there and even run it to check it works.

Works a treat - kudos to SendEmail team for lightweight app

Thursday, 12 March 2015

Restoring a Windows Backup to a 2008 or Vista Virtual Machine when you can't use SCSI drivers. USB drive wouldn't offline

A local company had an unfortunate incident with their buildings power supply which managed to blow up their server. We had a good Windows Backup of it (2008 SBS) however the USB drive seemed a little iffy.

To get them back online ASAP we decided to restore the backup onto the replacement server as a virtual machine - they already had a spare 2008 R2 licence so we used this as the host OS.

When it came to trying to restore the backup, the external USB drive wouldn't offline - which meant that we couldn't mount it as a virtual drive in the guest. To get around this, we ended up cloning the USB drive to a VHD and then mounting this instead.

All good, except I then discovered that 2008 cannot mount the SCSI drive from the installation area. A lot of digging later I was still with a solution and running out of time.

Eventually, I hit upon the idea of doing it over the network instead (why it didn't come to me sooner I don't know!). So I removed the Virtual Network Adapted, added a Legacy Network Adapter so the guest installer could use it and then shared the VHD on the host which was then access by the guest over the network and restored.

9 hours later (!) and just in time for the next day of trading of the company the restore completed and the server was good to go after a few driver tweaks here and there.

Next time this happens I'll remember to ignore the SCSI option for anything older than Windows 7/2008 R2 and just use a legacy network driver and restore over the network immediately.


Tuesday, 3 March 2015

Sage 2015 Accounts backup errors - unable to connect to the sage data service

With a new Sage update comes some more sage bugs - and this one threw me totally. After fixing problems with the sage data service on a server a client was still receiving the following error when trying to backup their data:

"unable to connect to the sage data service"

This didn't make any sense, as we were logged into sage which meant the service was working.

Eventually, we tracked this down to a bug in the new sage update which meant that if you connect to your sage data using a mapped drive (s: for example as most of our clients do) the local sage wasn't able to talk to the data service on the server.

This solution? Simply edit your company file to use a UNC instead of a mapped drive:

So what was: S:

Became: //servername/sage

Problem solved!

Cannot Configure Backup Schedule - SBS 2008 2011 - the filename, directory name or volume label syntax is incorrect. Adding a new backup drive to an existing backup set

Naturally, we have a lot of clients who using Windows Backup with SBS - its a great little utility that comes with reporting. In some situations we have 8 tapes running in a grandfather, father, son rotation which span many months.

Annoyingly, if you try and add a new backup drive to the job and don't have all the original disks to hand you will often get an error message such as:

Cannot Configure Backup Schedule
or
the file name, directory name or volume label syntax is incorrect. Adding a new backup drive to an existing backup set

You can get around this by plugging in all the backup drives and adding the new one - but does anyone have THAT many USB ports on a server? and what if some of the drives are offsite/failed/etc?

The alternative is to use the command line backup utility called wbadmin (windows backup admin). Follow the below steps:

1: Open up a command line with administrative privileges
2: wbadmin /? for a list of options
3: Assuming you have a job already running and you want to add another disk, firstly we have to identify the disk in question. So plug it in and then when the system is ready, type wbadmin get disks
4: A list of all the disks will appear in the system - look for the new backup drive and then right click and select "mark"
5: Click and drag to highlight the disk identifier string and then press enter (you've now copied it into the clipboard)
6: Now type: wbadmin enable backup -addtarget:{identifierhere}
{identifiedhere} should be replaced with the string you just copied (right click, paste)
7: press enter and then select Y if you are prompted to overwrite

As usual when messing with backup disks and windows backup, double and triple check its the right disk before accepting!

And that should be it - keep an eye on on the screen after you add a disk as if the system doesn't think its big enough it will alert you.



Thursday, 12 February 2015

Windows Black Screen of Death when you login on Administrator only account - no windows explorer shell visible until you kill the task and reopen in

A system was recently brought to me which had been badly infected with malware and other nasties. After much scanning and cleaning, the system was back in a usable state with one massive quirk:

Whenever an administrator logged onto the system the explorer shell wouldn't seem to launch - i'd just get a plain black screen. This was the case for all admin users, new or old.

On further investigation, there was an app running called "runonce", and when this was killed from the task manager the system booted correctly.

By checking the registry I found a left over key from all my cleaning work (HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce) which was launching a piece of software to take control of Chrome.

With this key removed, all of the admin profiles starting logging in correctly again

So I hope that helps someone; had I checked the key in the first place I wouldn't have experienced this problem the first place.

PS.
Massive shout out to Malware Bytes Anti-Rootkit (https://www.malwarebytes.org/antirootkit/) - best root kit removal software I've used to date and it's only beta.

Tuesday, 10 February 2015

Virgin Media Superhub and VPNs

Following a migration to an upgraded speed package on a Virgin fibre connection a hardware VPN stopped working properly. The connection would connect, but only remain up for 40 seconds and during this time very little data would transfer across it properly

On further inspection, even though we had public IPs hitting the equipment behind the superhub, the superhub itself was still interfering with data. 

To resolve this issue, you need to turn off the super-hub firewall (only recommended if you have another firewall behind it like we do) and then also go to the security settings and enable the VPN pass-through options.

Once this was done, the data was free to move correctly and the VPN no longer disconnected.

Usually this sort if thing gets checked, but if I have a public IP assigned to equipment behind the superhub I wouldn't expect it to ever play with the data its passing through.


We live and learn.


-- Update --

The above seem was originally written for a Super Hub 1 but since writing this I've also had to use it to resolve issues with software VPNs and Superhub 2s. The below steps to sort this on a SH2 are:

  1. Log into the Superhub (default IP is 192.168.0.1)
  2. Enter your username and password (this is generally on the bottom of the router)
  3. Go to Advanced Settings (at the bottom of the page).
  4. Go to (Security) "Firewall".
  5. Uncheck all boxes except "PPTP Pass-Through" – if PPTP Pass through is not checked, please check it.
  6. Click Apply