Archive for the 'Windows Admin' Category

SQL Server 2005: Missing Login Names After Restore

As mentioned in earlier posts, as time permits I’m migrating an old SQL Server 7 installation over to a new SQL Server 2005 installation.  One of the things I came across was that even though I had Users, Roles and Permissions set up an looking OK, I was unable to run even a simple SELECT query against the database without an error stating that the user didn’t have permission.  After checking all of the users/roles/permissions for the database and its tables and finding nothing wrong, I noticed that the properties for the user did not show a login name and any attempt to change the properties would demand a valid login name even though the field was greyed out and not editable!

The problem appears to be that when restoring an older database into SQL Server 2005, the login name can be assigned a blank entry.  The easy fix if your user names map to logins of the same name, i.e. login user1 maps to user user1, is to run the following query for each database user:

USE [database_name];
GO
EXEC sp_change_users_login ‘Auto_Fix’, ‘Username’;
GO

You should get the following response:

The row for user ‘Username’ will be fixed by updating its login link to a login already in existence.
The number of orphaned users fixed by updating users was 1.
The number of orphaned users fixed by adding new logins and then updating users was 0.

More info can be found here.

VirtualBox – Guest Additions

I wanted to take a quick look at Ubuntu 10.04 so I downloaded the latest VirtualBox VM software and grabbed the Ubuntu ISO so that I could just run a test on my local PC inside a virtual machine so I could play with it while doing other things.  I haven’t used VirtualBox for a while and while the guest OS install went fine, I couldn’t get the screen resolution to increase so my Ubuntu desktop was fixed at 640 x 480, even in full screen mode.  It turns out the additional functionality is available through installing Guest Additions.  I’m not going to go into the details of how to do it because there’s several straight-forward How-To’s on the web, for example here.

SQL Server 2005 Remote Connections

Yes, I know I’m way behind the curve here but I don’t normally used SQL Server as wherever possible I use MySQL instead.  However, we have one application which uses an old SQL Server 7.0 installation which is installed on a slowly failing server.  Since this application has become low traffic, I’m being tight and setting up a new server on a basic HP ML115 with SQL Server 2005 Express as it suits these specific demands easily and cheaply.

Anyway, I was having trouble connecting to the SQL Server 2005 service from a client machine and couldn’t see a reason.  No log files were being created on the server so I did a bit of research.  I came across Rick Strahl’s blog entry from 2006 (I did say I was working well behind the curve!) which explains that by default, SQL Server 2005 does not allow remote connections, which is fine if the setting is easy to find.  Unfortunately it’s in a completely different application called the SQL Server Surface Area Configuration Tool (what a great name, very intuitive). Activate remote connections and away you go.

In my case, no actually.  I still couldn’t connect remotely and, as it turned out, I couldn’t connect through ODBC on the server either.  Finally, I discovered the solution which was to set the connection to server_name\sql_instance_name not just the server_name.  For example, whereas on SQL Server 7 you can just connect to SERVER1, using SQL Server 2005 Express you need to connect to SERVER1\SQLEXPRESS because SQLEXPRESS is the default instance created during installation.  A simple difference but confusing at first!

Windows XP Won’t Login, Logs Straight Back Out

windows_xp_logoI’ve just had a problem with an XP machine not letting users log in.  It loaded to the user selection screen at which point you can log-in but it only flashed the screen and told you it was saving personal settings and returned to the user selection screen.  Booting in safe mode gave the same result.  It was impossible to actually get into windows to attempt to fix the problem.

A bit of research pointed towards a malware infection which was unusual in that malware normally wants something from you in the form of advertising revenue, money for dummy spyware removal or personal information.  The days of the old Chernobyl viruses which would literally try to take your hardware out appear to be gone.  However in this case it looked like malware at work.  I found reference to some malware which changed the registry entry for userinit.exe, a key component of the windows startup procedure, pointing it to an alternative, infected process.  I therefore needed a way to access the registry to change this entry back to the correct executable.

Continue reading ‘Windows XP Won’t Login, Logs Straight Back Out’

Forgotten XP/Vista Password

Windows Vista Logo A few weeks ago, a friend of mine asked me to look at his daughter’s laptop.  She had changed her vista password and then managed to forget not only the new password but what the hint she had set even meant!  So she had a laptop she couldn’t access with her school project work needed in three days and no backup.  I didn’t hold out much hope apart from reinstalling Vista.  There was no recovery disk for the Sony laptop so it would have been a fresh install and a case of hunt-the-driver to get it all working again, hopefully leaving her data intact.

However, I found a solution in the ‘Offline NT Password and Registry Editor’…

Continue reading ‘Forgotten XP/Vista Password’

Error 29506 From MSSQL Management Studio Express

sql_server_20051 I was trying to install Microsoft SQL Server Express onto a Windows 7 machine today and when I got to installing the Microsoft SQL Server Management Studio Express package I kept being prompted with the following error message:

error29506

After trying to download the package again and installing with the same result, I discovered that this error is actually due to Windows 7 (and Vista) having User Account Control, or UAC.  What we need to do is to install it as administrator and the easiest way to do this is as follows:

1.  Goto Start Menu >> Accessories >> All Programs

2.  Right-Click the Command Prompt ans select ‘Run as Administrator.

3.  Accept the UAC warning which comes up.

4.  Go to your downloads folder (eg.  cd \users\admin\downloads)

5.  Run ‘SQLServer2005_SSMSEE_x64.msi’ and the installation will complete as normal

Troublesome Spyware.

I had to look at a laptop last week which was infected with some kind of spyware although someone had already had a go at removing it and partially succeeded to the point that the exact nature of the spyware wasn’t apparent. Websites were being redirected, often to sites that were not even available, possibly due to being already shut down. AVG couldn’t update and Malwarebytes Anti-Malware would not install and run, even by changing the executable names.  I couldn’t get any anti-spyware to load even in safe mode.

I was almost at the point where it becomes time and cost effective to simply wipe the machine and re-install, when I came across a simple procedure which got me around the spyware’s defences.  If you ever have similar problems, it may work for you too.

1)  Click Start –> Run.

2)  Type “devmgmt.msc” and press enter.

3)  Click View –> Show Hidden Devices.

4)  Browse to “Non-Plug and Play Drivers”.

5)  Find “TDSSserv.sys”  (A known trojan self-defence service).

6)  Right-Click and Disable.

7)  Reboot

8)  Install Malwarebytes Anti-Malware and scan.

Malwarebytes found a dozen various instances of trojans and spyware and removed the lot.  AVG was then able to update and websites worked correctly.  Hopefully that’s the last I’ll see of it.

Vista: Sage Accounts 2007 Strange Behaviour.

Another day, another Vista incompatibility.  This time I found that Sage Accounts 2007 has an issue when running on Vista.  It’s not a terminal issue but it’s certainly an annoyance. When you have the customer or supplier list loaded, you can normally doubl-click on an account to open it’s details or select an account and click ‘Record’.  On Vista this will only give you a blank form instead of the account details.

Our Version of Sage 2007 is 13.02.17.0126

Sage article 15117 acknowledges the problem and reports that the only workaround is, when the details form is loaded, either type in the account number or select it again from the drop-down list.  If you have a lot of accounts, the drop-down list does not show enough entries to be very efficient so the best way is to type in the account number.

The Sage article does not mention which version you need to upgrade to to fix the problem. I have asked Sage if their is a fix available and am awaiting their response.

Update: The answer from Sage is that it is fixed in Sage Accounts 2008 so it’s upgrade or put up with it!

Vista: Run An App With Admin Privileges.

One of the applications our sales reps use on their laptops is a “Location Switcher” which allows them to specify whether they are connected to the live databases on the office servers or to the local copy on their laptop.  It also allows them to download a new copy of the databases to the laptop when they are connected to the office.  In order to copy the MySQL databases, the application needs to stop the MySQL service, copy the files and then restart the service.  There are more elegant ways to do it with MySQL Backup/Restore but this method is simple and straightforward.  The problem is, in order to stop/start a service, the application needs Administrator Privileges.

Vista provides this facility for an application.  To set an app to run as administrator, do the following:

  1. Right-click on the shortcut and select ‘Properties’
  2. Click the ‘Compatibility’ tab.
  3. Check the ‘Run this program as an administrator’ checkbox.

Now, if you want to run the application at startup, it’s no good using the old method of copying the shortcut to the ‘Startup’ program group because Vista will block any application trying to start with elevated privileges at startup and you can’t argue with the logic of doing so.  Instead, you can create a scheduled task to run it at log on.  The procedure is as follows:

  1. Click the Start orb and type “Task Scheduler” and press Enter.
  2. In the ‘Actions’ panel, click ‘Create Task’.
  3. Name the task and check the ‘Run with highest privileges’ box near the bottom.
  4. Click the ‘Triggers’ tab and then ‘New’ to create a new trigger.
  5. In the drop-down list at the top, select ‘At log on’.
  6. Choose the option for ‘Specific user or group’.
  7. Click the ‘Actions’ tab and then ‘New’ to create a new action.
  8. Type or browse to the location of the application you want to run.

Your application should now start at log-on with the required elevated privileges.

AVG 8 Side-By-Side Error on Vista.

I installed AVG 8.0 on the Vista Laptop and though the installation was fine,  Vista wouldn’t let me run it afterwards, simply telling me that it’s “side-by-side” configuration was incorrect.  Not very helpful, but fortunately we have Google!  The solution its seems is to reinstall the Visual C++ redistributables available for download from Microsoft here.  If you get the same error message from AVG or another application, it should fix it for you.