Thursday, November 02, 2006 

Restore MS SQL database on separate server

So in the midst of doing server migration, I was having a problem with a restored database giving me "permission denied" errors on the new SQL 2005 server I set up. It turns out the problem was due to orphaned users, where the users' old unique identifier (called a security identifier or SID) would not match the new server's even though the user names are equivalent.

To fix that in MSSQL 2000 and above, you first should determine the orphaned users by issuing the following query:
exec sp_change_users_login 'report'

Once you have the usernames, use the following query to reconcile the SIDs:
exec sp_change_users_login 'auto_fix', 'username'

Note that this will only work if you have the same named users on the destination server.

Tuesday, July 18, 2006 

Windows Media Services Logs

So I'm looking at enabling the logging features of WMS on our media server at work and decided to move them to a different drive partition in order to prevent log files from filling up the system drive. Unfortunately I wasn't paying close enough attention to the format required to include the date within the log file's name. Since I wasn't able to quickly find the information from Google, the default is:

%SystemRoot%\System32\LogFiles\WMS\\WMS_.log

Following a similar convention on a different drive is a matter of substituting the %SystemRoot% and subfolders accordingly.

Sunday, April 09, 2006 

Creating Hosts under Mac OS X

Under UNIX systems, normally your hosts file is located in /etc/hosts - this is not the case in Mac OS X. The recommended procedure you'll normally see online is to use the Net Info Manager, an application under the Utilities folder. While this isn't difficult, it's certainly not as fast as editing a text file using emacs or vi.

Thankfully Apple started using hosts files starting in Jaguar (10.2). To do it, open up a terminal session and do the following commands:
cd /private/etc
sudo emacs hosts
You will be prompted for your administrator password since this file is accessible to root by default. Once there you just need to add the IP address, hit tab, and then key in the domain as follows:
192.168.0.1 your.host.com
Save the file in the editor (Ctr-X, Ctrl-S in emacs and :wq in vi) and you should now be able to resolve the host properly.

Monday, March 27, 2006 

Enable Windows PHP Logging to a File

When installing PHP under Windows, the default option is to not log errors. These are available to view from the console but obviously coded web pages will not display these. The solution is to enable logging in the php.ini file. To do that, edit php.ini and locate the line:
;error_log = filename
First uncomment this line by removing the semicolon. Then replace filename with the absolute path to the error file (ie- C:\logs\php-errors.log). Enclose the path in quotes when you have any spaces in the name. Restart web services for the change to take effect.

Thursday, March 23, 2006 

Change the Site Identifier in IIS

In IIS you'll notice that each website you create gets a site identifier automatically assigned a random number. If you're like me, you'd like those sites to have some semblance of order. Unfortunately IIS Manager does not allow you to rename sites but if you download and install the IIS Resource Kit on your workstation, you'll find the IIS Metabase Explorer can handle this.

You should first do a metabase backup just in case something goes wrong. Then launch the IIS Metabase Explorer from the resource kit. Once open, do the following to change the site identifier:
  • Connect to your webserver by clicking the Metabase > Connect... menu.
  • Expand to the following key: LM > W3SVC and you will find your sites listed by the identifier number.
  • To change the site identifier, right-click the number and select rename. You can verify the site by going into the Root subkey and finding the ServerComment. This matches the name within the IIS Manager.
  • Once renamed you need to go into the renamed site's Root key and find the AppRoot name. That will still reflect the old site identifier in the form of:
    LM\W3SVC\xxxxxxx\Root
  • Change the numbers to reflect the new site ID number. Things like ASP require AppRoot so this must be done in order to preserve that functionality.
Once done, your sites should now reflect your new site identifiers.

Friday, February 24, 2006 

When Terminal Services Sessions Are Full

Terminal services is a great system for remotely connecting to Windows servers. Unfortunately you may sometimes find stale users who may be using up a connection (default 2 for administrative purposes) even though they aren't connected. When you try to log in, you'll get an error message, "The terminal server has exceeded the maximum number of allowed connections."

Traditionally this requires walking over to the console, logging in locally, and then bumping off the unused connections via Terminal Services Manager. However, using this preceding tip about console access via remote desktop saves you the trip. Very convenient when your server room isn't on the same floor as you or even offsite.

Monday, January 09, 2006 

Capture a printer port in Windows XP

In previous versions of Windows (back during Windows 95 days), DOS printing was an issue for legacy systems. Therefore capturing the Windows printers to make them look like vanilla LPT1: printers was done via GUI tools. However, that has been relegated to the command line with Windows XP. The "net use" command is used to map printer shares similar to providing mapped network drives. To map a shared printer as a local, DOS-accessible printer port, do the following:
  • Open a command prompt (Start > Run... and type cmd in the dialog box)
  • Type the following to map the printer share named "Network Printer" on the server named "PrintServer" as a LPT1: printer:
    net use lpt1: "\\printserver\network printer" /persistent:yes
  • The above command requires quotes only when there are spaces in the server's name or the printer share's name. The "/persistent:yes" command at the end denotes that this command will be applied even after reboot, so it can be eliminated for temporary usage.
  • To delete this printer in the future, you would simply type:
    net use lpt1: /delete
To provide access to this via Windows, you would then have to add the printer through the Add Printer wizard.

 

Manage Outlook's Address Book

For users who use a personal Contacts address book and have a departmental one also may find it useful to have look-up information available for the non-default address books. Here's how to manage your address book in Outlook:
  • Open the Outlook Address Book by going to the Tools menu and selecting Address Book (or Ctrl+Shift+B).
  • In the Address Book view go to the Tools menu and select Options...
  • Now you should be able to edit which address list should show up first, where to hold your personal contacts (for instance if all your contact entries go to a department-wide list), and finally also gives you the ability for the lookup order (say if the department list has entries which supersede the GAL).
One other Outlook Address Book tip: if you have an address list that doesn't show up as an Outlook Address Book, right-click it and go to Properties. Then click the Outlook Address Book tab and make sure the checkbox "Show this folder as an e-mail Address Book" is checked. Any address list you wish to hide would just require removing this checkbox.

Thursday, December 01, 2005 

Proliant ML330 Hard Drive Performance Boost

At work, we're using an old version of Webtrends to do all our web analytics. With average daily log files of 2 GB, this is a pretty intensive procedure that taxes all aspects of the system like memory, disk, and CPU. I have been running these stats on a base desktop system with 2.8 GHz Pentium 4 and 512 MB RAM.

Certainly not the best machine for Webtrends but it has been adequate for the past year. However, I recently was forced to replace this setup with a Proliant ML330 that was a decommissioned webserver. With a 2.8 GHz Xeon and ATA-RAID drives, I expected this to be a good base once the 256 MB of memory was increased.

What I didn't expect was for my 2 day-long reports to take double that time on the Proliant. Even with the memory starved machine, this was totally unexpected. Further investigation revealed the disk utilization was where the sluggishness was most apparent.

After performance testing within Windows and off a boot CD, I determined the striped hard drives (RAID-0) were performing at a quarter the speed of the desktop I tested. After opening the chassis, I found the drives were both connected to one channel on the built-in RAID.

I decided to put the second drive on its own channel, which is my preferred setup anyway, and retested the system. It is now performing approximately 50% faster than the desktop benchmark.

Monday, November 28, 2005 

Windows Environment Variables

As a matter of convenience when navigating Windows Explorer, you can use the system's environment variables to quickly locate certain folder locations. This can be especially useful when the Windows installation is not using default values (say the system drive is D: or you've moved the home folder). From the address bar, just type the following to get to the specified folder:
  • %systemroot% (Windows directory, eg: c:\windows)
  • %windir% (Windows directory, eg: c:\windows)
  • %systemdirectory% (The Windows system directory, eg: c:\windows\system32)
  • %homepath% (Current user's home directory, eg: c:\documents and settings\user)

Tuesday, November 08, 2005 

Fixing Outlook's Reminders

One of my Exchange users was having problems with her calendar. Every time she was in Outlook, she was greeted with the following error:
There was a problem reading one or more of your reminders. Some reminders may not appear. Cannot locate recurrence information for this appointment.
This resulted in a few problems such as not getting any reminders unless logged into the system using OWA and the inability to sync her calendar with her Palm Treo 650. Taking a look online for solutions resulted in many unrelated issues, the most popular being an MSKB article that requires a hotfix for Outlook 2000. Since my system is Outlook 2003-based, this wasn't helpful at all.

Turns out that the problem was with a corrupted recurring calendar item. To ferret it out and delete it, you need to find all the recurring appointments in your calendar:
  • In Outlook, click the Calendar folder
  • Go to the View menu, choose Arrange By > Current View > Recurring Appointments
  • Then you should open each appointment located in that filtered view until you locate the item that gives you an error that the item cannot be opened. Note the appointment's details and then delete it.
  • Once deleted, you can go back to the default view by going into the View menu and choosing Arrange By > Current View > Day/Week/Month
Once complete, reminders should once again be active.

 

Troubleshooting Firefox

For as many years as PDF has been popular, I've always hated viewing them within the browser. So on all the systems I use, I choose to disable the plug-in and have the PDF saved to my desktop instead. Thus it was a little irritating to see that Firefox stopped downloading PDFs correctly and just hung as it finished the download. I finally had a chance take a look and started by reinstalling Firefox. This didn't make any difference, so I dug a little deeper and backed up the profile. To find your profile, open Windows Explorer and type the following in the address bar and hit Enter:
%appdata%\Mozilla
From there, I'd suggest renaming the Firefox folder so you have your bookmarks and settings backed up. Then when you launch Firefox, it will generate a new profile folder:
%appdata%\Mozilla\Firefox\Profiles\xxxxxxxx.default
Once that's done you can reapply your settings (in this case disabling the PDF plug-in). Just a note of caution: make sure Firefox is closed before you attempt moving your bookmarks.html file from your old profile. Otherwise Firefox will delete it and use its last backup (the default bookmarks.bak in the new profile) once the program has been closed.

Monday, November 07, 2005 

Reset Your iPod

Not a hard tip but one that can be useful when your iPod freezes, frequently due to hard drive vibrations. For a 3G iPod (which has a row of buttons across the top), you simultaneously press the Menu+Play/Pause buttons. For a 4G iPod (any device with the click-wheel), you would hold the center button+Menu simultaneously.

This may clear some personal settings such as On-The-Go Playlists that have not been synced to iTunes.

Thursday, October 27, 2005 

Mac Guide to Working with Exchange

From the Entourage blog, I just came across a PDF entitled Working with Exchange that has a bunch of useful information for anyone who's looking to provide Exchange for Mac clients. This white paper discusses several scenarios for connecting your Mac users such as Entourage, Outlook for Mac, Remote Desktop, and even Virtual PC along with advantages and drawbacks.

Basic troubleshooting for Entourage 2004 is also available in the document.

Thursday, October 20, 2005 

Uninstall Extensis Suitcase X1

Uninstalling on the Mac is usually a pretty straightforward matter of deleting the folder or application within the Applications folder of the system. However, that leaves behind all the trails like preferences or libraries for certain application types. Here's how to remove Extensis Suitcase X1 from a Mac:
  1. Remove the "Extensis Suitcase X1" folder from the /Applications folder
  2. Go to /Users/%username%/Library/Preferences and remove the following:
    com.Extensis.Suitcase.plist
    Suitcase Preferences folder
  3. Empty the trash and reboot your computer to verify that everything has been removed.

Wednesday, October 19, 2005 

Reinstall the TCP/IP stack in Windows XP

With all the malware infecting computers over the Internet, some crafty types have successfully modified the Winsock networking stack in Windows. This can cause many problems, including disrupting network connectivity and performance problems. Windows XP SP2 made such reinstalls simple by issuing the following at a command prompt:
netsh winsock reset
You can also rebuild the key and bring it back to default status. However, any program that has added or modified layered service providers (LSP) those programs need to be reinstalled. But if needed, this can save a reinstall of the entire system. Issue the following at a command prompt:
netsh winsock reset catalog
If you are on an earlier version of Windows, however, there isn't a commandline tool. Here are the manual steps required:
  1. If you're not using XP, uninstall TCP/IP by going to the LAN adapter properties (found in the Network and Dial-Up Connections in Windows 2000). Highlight TCP/IP and click the uninstall button from the LAN properties page.
  2. Now open the registry editor (Start > Run > regedit)
  3. Locate the following two keys and delete them:
    HKLM\System\CurrentControlSet\Services\Winsock
    HKLM\System\CurrentControlSet\Services\Winsock2
  4. Restart the computer so that the system reinserts the above registry keys.
  5. Now reinstall TCP/IP by going back to the LAN adapter properties. Click Install, choose Protocol, and then click the Add button. Choose the Have Disk button and select C:\Windows\Inf (substitute as needed for your system root). Then choose TCP/IP and complete the install.
Once finished, network connectivity should be restored. More information can be found in MSKB 811259.

Monday, October 17, 2005 

Change Windows XP Product Key

I got a call from a former colleague asking if there was a convenient method to change the 25 digit product key in Windows. With a little registry tweaking, it is a very simple matter to do so:
  1. Open regedit and navigate to HKLM\Software\Microsoft\Windows NT\CurrentVersion\WPAEvents
  2. Open the REG_BINARY value of OOBETimer and change the value. For instance simply delete the last couplet of digits and add 11 or FF to it. Hit OK and close the registry editor.
  3. Now go to Start > Run... and paste in the following (substituting your Windows folder like C:\Windows for %SYSTEM ROOT%):
    %SYSTEM ROOT%\system32\oobe\msoobe /a
  4. At the following dialog click the bottom button to Change Product Key.
  5. Enter in the new product key for the system and click Update. After the system verifies the key's integrity, you will be returned to the telephone option screen. Click the Remind Me Later button and restart.
  6. To verify that Windows has been returned to activated state, re-run the command from step 3. You should be given the notification that Windows is already activated.
Microsoft also outlines this process in article ID 328874.

Wednesday, October 12, 2005 

Configure Mac Tiger with Active Directory

Getting a Mac onto Active Directory has in the past caused many headaches. But it seems that Mac OS X 10.4 (Tiger) has automated several key steps that used to make it difficult to configure Active Directory via Apple's built-in Open Directory software. Prerequisite information that must be obtained by the Sys or Netadmin:
  • Must have local administrative rights on the Mac
  • Must have a domain administrator password to bind the computer to the network
  • Must have the Active Directory domain name (such as east.microsoft.com)
  • Must have the domain controller's DNS name for LDAP functionality (such as dc.east.microsoft.com)
Now for the configuration of Active Directory:
  1. Launch Directory Access, located in the /Applications/Utilities folder.
  2. Click the lock button on the bottom left to authenticate the administrative password
  3. Once authenticated, double-click the Active Directory line to configure it.
  4. Fill in the Active Directory Domain (east.microsoft.com) and Computer ID. The ID will be the computer's name in AD so you should try to use the standardized name for your AD environment.
  5. Click the Bind... button and you will be prompted for a domain administrator's credentials (technically any account enabled to add objects to the directory). Enter this information in and if needed, change the OU as required by your AD installation. By default it goes to Active Directory's default container of "Computers" within the root of the domain.
  6. Once you click OK, the machine will go through a few steps to join the domain. Once complete, the Bind... button will become Unbind.
  7. Finally, to aid in system management, click the "Show Advanced Options" button and then click the Administrative tab. If you have multiple domain controllers, you can here select a preferred server. Also you can click the option to Allow administration for enterprise and domain administrators. Click OK to complete the Active Directory configuration.
Now that Active Directory has been established, you should add LDAP:
  1. Double-click LDAPv3 to begin configuring it.
  2. Click the New... button and then click the Manual button that appears in the pop-up for the quickest configuration
  3. Now you should be back at the base configuration pop-up. Name the configuration as you see fit and then hit Tab to enter your domain controller's DNS name or IP address.
  4. Then click the dropdown for LDAP mappings and select Active Directory. Then you will have to enter the search suffix base. Use the DNS domain name for this, but you need it represented in FQDN format. In my example of east.microsoft.com, it would turn into:
    DC=east,DC=microsoft,DC=com
  5. Click OK to exit both menus and quit out of Directory Access.
My final recommendation is to then go into System Preferences and select the Accounts applet. From there, authenticate with your administrative credentials and click "Login Options" at the bottom left. Then hit the radio button of "Name and password" under "Display login window as:" so that you can enter any AD username at the login screen. Log out of the local profile and try logging back in as a domain user. Assuming that everything works as expected, you can login with any domain user account which will automatically setup a local profile on the Mac.

 

Change MacOffice 2004 Product ID

My company purchased several licenses of Office 2004 a year ago and sadly some former employees absconded with the install discs for each of them. Thankfully I do save all product numbers and serials within a database. Now that it's hardware upgrade season, I can at least copy the Office folder between the one of the unused old machines and get the new computers up and running. But the problem is that Microsoft checks product IDs to prevent piracy. Thankfully you can enter a new product ID by deleting the old one. From Terminal use the following commands:
cd /Applications/Microsoft\ Office\ 2004/Office
rm OfficePID
Once removed, Office will launch the setup wizard allowing you to enter the appropriate product ID. Once the new equipment is rolled out and the old stuff decommissioned, the old machines' product numbers won't interfere with the new computers.

Tuesday, October 11, 2005 

Installing PHP and MySQL on Windows IIS 6

Getting PHP and MySQL installed under Windows IIS takes more effort than your average Windows server install. While Microsoft has made IIS installation relatively effortless in recent years, these F/OSS components can be a bit challenging to work with. The MySQL installation is easy enough but it leaves you with a bare database service that requires the command line to do any database functions. Here's what I had to do in order to get all the components working properly under Windows 2003:
  1. Install IIS 6 by going into Add/Remove Programs (under the Control Panel) and then select Add/Remove Windows Components from the left side of the menu.
  2. The Windows Components Wizard will open. Double-click the Application Server line. Click the checkbox to install Internet Information Services (IIS), which installs the Common Files, Internet Information Services Manager, and World Wide Web Service. If you require SMTP or NNTP, click the Details... button to add them. Hit OK until you return to the Wizard.
  3. Click Next to begin the installation (which requires either the Windows CD or a path to the i386 directory).
  4. Once IIS is installed, download and install MySQL. I used the Windows MSI installer with the Essentials Package. Choosing the Custom Install option gives you the opportunity to choose the destination folder. I recommend using a folder structure that has no spaces (such as C:\MySQL) since spaces can result in configuration issues. Once you've chosen your folder, you can skip the MySQL.com account creation and finish the install.
  5. MySQL's installer will give you the opportunity to configure the server. You can get away with using the Standard Configuration but the Detailed Configuration does give you the opportunity to choose the server roles, including database type. The defaults are fine for most options. Just make sure that you add the install directory to the PATH when given the option. Add a root password and the following screen will complete the configuration.
After IIS and MySQL are finished, the PHP install comes next. This is where particular attention needs to be paid, since you may find a lot of conflicting information on Google regarding the exact setup. There are multiple parts involved in setting up PHP so they will be broken up into a few parts. Part I is how to download and configure the initialization file:
  1. Download the latest zipped version of PHP. The installer seems to introduce problems so the archived file is recommended. Uncompress the folder to your hard drive; again, the easiest configuration is to use a folder structure without spaces (like C:\PHP5).
  2. Open the directory and locate the file named "php.ini-recommended" remove the "-recommended" part from the filename so it becomes "php.ini". Open this file in a text editor.
  3. Search for "doc_root" and type in the path to the home directory listed under the default web site in IIS Manager. (Right-click your website, click Properties, and then go to the Home Directory tab.)
  4. Search for "cgi.force_redirect" and make sure it's uncommented (delete the semicolon) and make it equal to 0 (zero).
  5. To use PHP sessions (which is optional), first create a directory (for instance C:\PHP5\sessions) and then key that path into the "session.save_path" line in php.ini.
  6. Now to get PHP extensions working, as is required for MySQL support, you will need to first find the "extension_dir" line and enter the path to PHP's extensions subdirectory (such as C:\PHP5\extensions). Then uncomment out the line "extension=php_mysql.dll" in the php.ini file. Any other extensions you require should also be uncommented.
  7. Save the php.ini file and exit out of the text editor.
Part II describes setting up Windows to use PHP properly:
  1. Add PHP's folder into the PATH environment variable. Right-click My Computer and select Properties. Under the Advanced tab click the Environment Variables button at the bottom. Then scroll the System variables section to find Path. Double-click it and enter your PHP path at the line's end appending a semicolon (such as c:\PHP5; in my example). You should not have to restart in order for this to take effect.
  2. Now in order to have Windows read the php.ini file you created earlier, you must either copy the php.ini file into C:\Windows (supposedly hard coded into PHP) or you can point to the ini file's location with the Registry. To do that, create a text file someplace on the server and paste the following into it and save it as phpini.reg:
    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\PHP]
    "IniFilePath"="C:\\PHP5"
    Note the above assumes C:\PHP5 is your directory. Substitute as needed, but remember that any backslash in the path needs to use the escape code of double backslash. After this is saved, double-click phpini.reg to add the information to the registry.
  3. Now launch IIS Manager for more configuration fun. First thing is to add PHP as a web service extension and allow it to run on the server. In IIS Manager, expand the local system and then right-click the "Web Service Extensions" folder and click "Add a new web service extension".
  4. Under the Extension name you can enter PHP and then click the "Add..." button. Browse to your PHP directory, double-click the "php5isapi.dll" file, and then hit OK. Then click the checkbox "Set extension status to Allowed" and then click OK.
  5. Now right-click Web Sites and click on Properties. Under the Home Directory tab, click the Configuration button. Click the Add... button to create the PHP extension. Browse to the PHP directory and double-click the same "php5isapi.dll" file from the last step. Type ".php" as the extension and then under the Verbs section select "Limit to:" and enter "GET,POST,HEAD" on the line. Click OK to return to the Web Sites Properties.
  6. This next step is optional but recommended. Click the Documents tab in the properties page and click the Add... button under the default content page. Call it "index.php" and then hit OK. Select this and move it to the top of the list. Click OK to close the properties page which will then prompt you to make those changes on each website listed (should just be 2 prompts if you have the Default Web Site only).
  7. Then expand "Web Sites" folder on the left pane, right-click the Default Web Site (or any other site(s) that need PHP) and select Properties.
  8. Under the Home Directory tab verify that the Execute permissions: line is set to "Scripts Only" and then click OK.
  9. Finally the configuration is complete. In IIS Manager, right-click the local computer, go to All-Tasks, and then select Restart IIS... Hit OK and PHP should be configured.
To verify that PHP is working properly, create a text file in the root of the website, name it info.php and place the following code into it:
<? phpinfo(); ?>
This page gives all the basic information of your PHP install. Spot check and verify the configuration for things like the Configuration File (php.ini) Path, doc_root, and extension_dir. Also you should see a table belonging to mysql that will provide the API version number.
Your PHP and MySQL webserving platform should now be ready to go. Thanks goes out to Pete's Place for an excellent guide; unfortunately I happened upon it late into my own install headaches! But that guide still worked well for working around doing needless server restarts and providing extra functionality (like adding support for sessions).