Wednesday, July 22, 2009

Automate and schedule Microsoft Access macros

If you are running various Microsoft Access databases (haven't quite gotten to SQL yet...) which need to be updated, it's usually nice to be able to automate the updates. While there is no built-in scheduler within Access, you can call macros from the command line, which then means you can script macros through the use of a batch file.

1. Create a new text file with an extension of .bat. You can use save as, or unhide extensions to use the .bat extension
2. In that file, put the full path to the Access executable surrounded by quotes, which will be

Office 2007 - C:\Program Files\Microsoft Office\Office12\MSACCESS.exe
Office 2003 - C:\Program Files\Microsoft Office\Office11\MSACCESS.exe

depending on the version of Access you're using.
3. Now put a space, then add the full path to the Access file you want to automate surrounded by quotes, including the file name. For example, "C:\Access Files\MyDatabase.mdb"
4. Now add a space to the end of that, and add the /x switch, followed by a space, then put the macro name (no quotes needed).
5. Save your .bat file, making sure it stays in .bat format.
6. Go to Start->All Programs->Accessories->System Tools->Scheduled Tasks, and create a new task. When asked what you want to run, browse to your .bat file and select that. Choose the rest of the options according to whatever schedule you want to put the macro updater on

In the end you should have a single line in your batch script that looks something like

"C:\Program Files\Microsoft Office\Office11\MSACCESS.exe" "C:\Access Files\MyDatabase.mdb" /x AutoMacroName

That's it. You now have a fully automated macro on a schedule. There used to be a point in time where we had a user who would start a macro when they arrived in the morning, and then sometime in the afternoon they'd be able to use the updated database. That's very inefficient, and can be a huge waste of time. This automation process can be a great time saver and allow you to update information after-hours, rather than making someone do it manually and wait for the process to finish.

The next thing you might want to look into is adding an email notification to your automated process so you know whether or not it finished. To do that, check out my other post about adding email notifications to ntbackup. The process behind both are practically the same. If you're interesting in more scripting, do a quick search and you should find a few more articles on the site too.

For more command-line switches for Microsoft Access, check out KB 209207

Monday, July 13, 2009

lpadmin error when trying to print in OS X 10.5

This is a known issue in OS X 10.5.7, and Apple has a support article with the supposed workaround. Trying to login as the lpadmin fails, and I'm sure if you found this article you're frustrated with trying to figure out which password you should be using. The trick is to upgrade the lpadmin group to support GUID membership. To do that, you can use a terminal command while logged in as a local administrator.

1. Go to Applications->Utilities->Terminal
2. Enter the command dseditgroup -o edit -p -a admin -t group _lpadmin and then press Enter
3. You should get a response saying _lpadmin has been upgraded to support GUID membership.

Try printing now and it should be fine. To see the Apple support page, check article TS2754

PS - I have seen this only act as a temporary fix on a few Macs that I have setup to connect to Active Directory. I'm not sure why, so if you run across this and can explain why this works for some AD Macs but not all (as a permanent fix), please leave a comment. Thanks!

Thursday, July 9, 2009

Check which process is using which port in Windows

Ports are used all the time. Some are standardized (25 for SMTP), and others are dynamic. I ran into an issue setting up a TFTP server yesterday where it said it couldn't start because another process was already using the port, even though I couldn't think of any programs I had running that would have had it in use. I had to investigate, and being that it is simple, I thought I'd share the process. Also, matching ports to processes can help catch or track down spyware/malware, which typically uses some type of Internet connection.

1. Open a command prompt. You can do this by going to Start->Run, typing "cmd", and pressing OK
2. Use the command "netstat -a -n -o". This will list all active ports, along with the process id of the process that is using it. Find the port you want to check, then look at the PID listed for using that port. Remember the PID
3. Now use command "tasklist /FI "pid eq yourPID"", making sure to surround "pid eq yourPID" in quotes. This will filter (/FI) your tasklist results, and only show programs using the PID equal to yourPID. Make sure to substitute the numerical PID from step 2 in for the yourPID text in the command.
4. If you'd like to stop the process that you found, use the command "tskill yourPID" to terminate the process, remembering to substitute your process ID value in for the yourPID text.

You can also use Task Manager to track down the process once you have the PID if you would like. However, the PID column on the Processes tab is not displayed by default, so you will have to add that (go to the Processes tab, then to View->Select Columns...). You can then check and end the process with the more familiar GUI interface.

Tasklist is a very helpful tool. One additional use for tasklist is for tracking down programs that are using svchost.exe. If you're interested in that, check out my previous post.

Tuesday, July 7, 2009

Enable LACP on an HP Procurve switch

First off, make sure your switch supports LACP. Not all of them do. If yours doesn't, or at least doesn't out of the box, check to see if there are any firmware updates on HP's site that enable LACP support, which you can find at http://www.hp.com/rnd/software/switches.htm. You also want to make sure that the device you're connecting to the switch supports LACP too, but hopefully you've already done that since you're looking how to set it up.

Ok, to enable LACP (link aggregation control protocol) is pretty easy. You have to have admin access to your switch, and also access to the CLI (command line interface) which you can get through with a simple telnet session to your switch's IP address. There is dynamic LACP, which is more of an automated configuration, but it limits your LACP link to running in the default VLAN only. I believe you can just plug the Ethernet cables into your switch and it will automatically recognize LACP is setup, as long as it is already configured on the device you are connecting. If you have multiple VLANs and need LACP to run in a VLAN other than the default, the only option is to manually set up static LACP, which is what this post is going to cover.

1. Login to the CLI on your switch, which you can do by opening a telnet session to the switch's IP address
2. Enter the username and password when prompted
3. Use the command "config t" to get into the configuration terminal. You'll know this worked when you see (config) appended to the end of your device name.
4. Use the following command to create your LACP trunk of ports: "trunk 1-4 trk1 lacp" then press Enter. This will create a new LACP trunk using ports 1, 2, 3, and 4, and name it trk1. For trk1, you can use anything from trk1-trkX, where X is the last port number on your switch. You can substitute whichever ports you want to use to create your LACP trunk. If you just want to use trunking rather than LACP, simply replace LACP at the end with the word trunk
5. Use the command "show lacp" to check the settings. You should see columns for "LACP enabled", "LACP Partner", and "LACP status". Assuming you already have the device configured for LACP and plugged into your new LACP ports, those three columns should read "Active", "Yes", and "Success" respectively. If the first column says "Passive", go to step 5b. Otherwise skip right to step 6.
5b. Enable Active LACP mode on your trunk ports. To do this, make sure you're in config mode and then use the command "interface 1-4 lacp active", substituting the port numbers you used in your trunk in the command. The command above changes ports 1, 2, 3, and 4 to active LACP mode
6. Now you have to put your new LACP trunk into the correct VLAN. Let's say I want this trunk to be in VLAN 2. To do that, I'll use the command "vlan 2 untag trk1". Substitute the VLAN number and trunk number of the actual trunks you are going to be using
7. That's it. You should now have yourself a static LACP trunk on your HP Procurve switch, and it should be in the correct VLAN for you to start using.

If you want to remove a port from your trunk at some point, you can use "no trunk 1" which would remove port 1 from the trunk. You can use port ranges too, so "no trunk 1-4" would completely remove the trunk that was setup in the example.

For more information, check out the pdf instructions from HP here. To see the original post that pointed me in the correct direction, click here.

Monday, June 29, 2009

Start a Microsoft Office 2007 program in Safe Mode

This is really simple, and can help diagnose issues and problems you may be having with Microsoft Office products, such as Word, Excel, Powerpoint, and Outlook. In order to start the application in safe mode, simply hold down the Ctrl key when selecting it from the Start menu (Start->All Programs->Microsoft Office, then pick the icon of the program you want to open). You will be prompted asking if you want to start the application in safe mode, so assuming you do, select yes to continue.

Microsoft has this posted here

"Cannot start Microsoft Office Outlook" error

I had a user report that she could no longer get Outlook 2007 to open and was getting the error "Cannot start Microsoft Office Outlook. Cannot open the Outlook window." dialog box, as seen below.



I wasn't sure what was causing it, so I started my troubleshooting. I first tried opening Outlook in Safe mode, but that didn't help. I knew she has installed some Windows updates early today so I tried a system restore, but that didn't work. Then I turned to thinking her mail files were possibly corrupt, so I used scanpst to check them for errors and repair what it found. That didn't work either. I was stumped, so I turned to Google. It was then that I ran across what ended up solving my problem.

It was an Outlook switch I had never heard of before. resetnavpane, and it worked like a charm (thanks d-pabs). Here's how to fix it, and I'm going to assume you're using Outlook 2007. If you run into this issue while running Office 2003, the only difference is the path to the Outlook.exe file should be Office11, not Office12 as shown below

1. Go to Start->Run
2. Type cmd and press OK (alternatively, open a command prompt window however you'd like)
3. In the command prompt window, type "C:\Program Files\Microsoft Office\Office12\Outlook.exe" /resetnavpane and press Enter. Make sure you actually type the quotation marks with the path in this instance since it is required in order for the command prompt to recognize the path to the Outlook executable since there is a space in it.
4. This should start up Outlook and you should be able to get into your email again

Thursday, June 25, 2009

napclientprov.mof error during Windows XP install

First, I'm going to guess that you either tried to slipstream Windows XP SP3 onto your install CD, or you have an install CD that is supposed to contain service pack 3. This isn't a bad thing, but from what I've read, the problem is related to CD's slipstreamed with service pack 3. Anyway, on to the fix.

The good news is that at this point of the install, napclientprov.mof should already be installed on the machine. You can click on Browser, then navigate to C:\Windows\system32\WBEM. You should see the napclientprov.mof file there, which you can then select and click OK to get the installer to continue. I don't have much more of an explanation than that, but it solved the issue for me so I'd expect it to do the same for you.

If you don't know what slipstreaming is, it is when you package Windows updates on your install CD so you don't have to go through all the updates post-install. It can save a lot of time if you have multiple machines to install Windows on, and it's pretty easy to do using a free program called nLite. To read more about how to slipstream updates, check out one of my earlier posts here.

Wednesday, June 24, 2009

iPhone not recognized in iTunes on Windows XP

I had a user who got an iPhone, installed iTunes (8.2), but couldn't get the iPhone to work in iTunes. It is a 16GB iPhone 3G. I took a look and couldn't quite figure it out right away either. I uninstalled/reinstalled iTunes, checked device manager and saw the iPhone recognized as a digital still camera, and kept getting an error from iTunes saying that it detected an iPhone but it wasn't recognized properly and needed to be unplugged then plugged back in. That didn't help. I finally seem to have figured it out, and came up with what I expect caused it to begin with.

First off, I belive the cause of the problem was that the user had first plugged the phone in to the computer while talking on it. This caused the OS to have issues recognizing the phone correctly, which then carried over every time the device was plugged back in. The reason I believe this is because I got it to work, then the user plugged the phone in while talking to me and it stopped working again. Luckily the same fix worked both times, and is quick and easy.

The solution to the problem, once it starts happening, is to update the Apple Mobile Device USB Driver. To do this, follow these instructions:

1. Right-click on the My Computer icon and select Manage
2. In the left tree-view column, click on Device Manager, which is under the System Tools section
3. On the right, expand Universal Serial Bus controllers which is likely towards the bottom
4. You should see Apple Mobile Device USB Driver there. If not, make sure your iPhone is plugged in. Assuming it is there, right-click on it and select Update Driver



5. Choose to allow it to install the update automatically, which should be the default, and click Next
6. It should appear to be doing some searching, then act as if it's installing something, then it will say it is finished. Click the button to close
7. Now try opening iTunes again and see if your iPhone is recognized correctly. Hopefully it is, and you can go on using your iPhone like normal and synchronizing it with iTunes

Once I updated the Mobile Device driver it seemed to work fine. Then the user plugged it back in while talking on it, and the same error started appearing again in iTunes. Again, a quick driver update and the problem was gone. If you're having the same problem and run across this, hopefully it takes care of it and you can stop stressing out over your phone. Good luck

Update: If this doesn't work for you try resetting your phone, then uninstall iTunes, reinstall iTunes, then plug your phone back in. It sounds like a hassle, and it is, but if it'll fix your phone then it'll be well worth it. To restore and reset your phone, check out my previous post. If you can't reset using the normal method you may have to use recovery or DFU mode, which are covered in previous posts as well. Once the phone has been restored to factory defaults (which means you need to choose to set it up as a new iPhone during the restore process), then go ahead with uninstalling iTunes. To do that, follow the uninstall directions in the Apple KB. Once you've uninstalled iTunes, go ahead and reinstall it while making sure to restart your computer in between the uninstall and reinstall. Once iTunes has been reinstalled, plug your iPhone into your computer and let the computer recognize and install it. If this works properly then you can go ahead and use iTunes to restore your phone to the most recent backup of the old settings. If this doesn't work then I'd suggest going right into a DFU mode restore if you didn't have to already, then trying to plug the phone in again. If that still doesn't work then I would say it points at a hardware failure. Be sure to verify your connection cable is working correctly before completely giving up, but if that's not it either then you're stuck relying on the warranty (if you still have one) or using the iPhone as a paperweight.

Show or hide icons on your Blackberry phone

I've seen this happen to people many times, but sometimes icons seem to disappear from their Blackberry menu and they don't know how to get them back. Sometimes it appears to be completely random, and other times it's probably the user clicking too quickly. Either way, it's easy to hide or show icons. Here's how:

To hide icons
1. Highlight the icon you want to hide
2. Hold down Alt, then press down on the select button
3. Scroll down to Hide and press down on the select button

To show icons
1. On the menu screen, hold Alt and press down on the select button
2. Scroll down to Show All and select it
3. Now you should see all the icons, with the hidden icons looking mostly transparent. Highlight the icon you want to show
4. Hold down Alt, then press down on the select button. Hide should be checked
5. Scroll down to Hide and press down on the select button to uncheck that option

Tuesday, June 23, 2009

iPhone Lite on Verizon's network

I just got out of a meeting with Verizon rep, and in talks with the rep I asked about the likelihood of Verizon getting the iPhone. According to the rep, the iPhone Lite is slated to be released yet this year (2009, but no definite date), followed by the full iPhone on the Verizon network in early 2010. They're also working on their EVDO upgrade, which will be known as LTE (long-term evolution) and that's expected to be implemented in 2010 as well, but this has already been reported by various sources. The iPhone Lite will be a slightly smaller than the current iPhone models, and will also have less memory. For those of us who really just need a phone for calls and email, it'll probably be a good fit rather than the overkill we get with the current iPhones. Tethering was also mentioned, and the rep expects it to be allowed on the Verizon network. From the conversation we had, I'd say AT&T needs to watch out because their reign on the iPhone may be in jeopardy soon.

UPDATE 10/28/2009 - As most of you already probably know, recently Verizon released new iPhone attack ads because of the upcoming release of a Google Android phone on the Verizon network. At this point, it is unlikely that Verizon would do this is they were planning on getting the iPhone themselves, so I think it is safe to say that iPhone users are stuck with AT&T even longer. The good news is that with Google gaining momentum and increasing the availability of their Android phone selection to more providers, Apple won't have much of a choice but to open up the iPhone to other carriers in order to keep up. The problem is that it likely won't happen soon, and the newest thought is that Verizon will be looked at for the iPhone only after they've finished deploying their upcoming LTE network.