LANalyze

Tools for techs, and other random stuff I come across.

How to delete 0 byte files from a batch script

August 29th, 2008 . by snoel

Frequently you need to process files in a folder but don’t want to deal with 0-byte files… so how do delete these pesky files in your script? Easy - in one line:

for /f “tokens=* delims=” %%F in (’dir /s/b/a-d d:\folder’) do (if 0 equ %%~zF del “%%F”)

You can use the same technique for files that are smaller than a certain size, or bigger than a certain size by replacing EQU with LSS or GTR.

The new face of arcade games?

August 24th, 2008 . by snoel

I love MAME and have wanted to build my own MAME cabinet for a long time. The closest I’ve gotten is an X-Arcade joystick mounted to a bakers rack at a comfortable height. I ran across this the other day and thought it was a nice look - retro gaming in an ultramodern shell:

Modern Mame cabinet

And how about this one for the inspiration from 1971:
1971 arcade cabinet

Source: http://www.retrothing.com/2008/08/retro-space-21s.html

Free Vista SP1 support

August 24th, 2008 . by Administrator

By the way, in case you didn’t know, Microsoft is offering free support
on SP1… business hours only:

Free unlimited installation and compatibility support is available for
Windows Vista, but only for Service Pack 1 (SP1). This support for SP1
is valid until March 18, 2009. Availability of chat or e-mail support
differs depending on your geographic location. For customers residing in
North America or Canada, chat and e-mail support is available. Some
issues may require more advanced support for which there is a charge.

No-charge Unlimited support requests: (866) 234-6020

PC Manufacturer contact info

August 24th, 2008 . by Administrator

Microsoft publishes these numbers at support.microsoft.com/gp/oemphone
so you can get in touch with your manufacturer if you have an oem
windows license installed:

Acer (800) 816-2237
IBM (800) 426-7378
Averatec (877) 462-3462
Lenovo (866) 96-THINK (968-4465)
Compaq (800) 652-6672
Maxdata (626) 935-0050
Dell (888) 560-8324
EMachines (408) 273-0888
Medion (866) 633-4660
Fujitsu (800) 831-3183
NEC Corp (800) 338-9549
Panasonic (800) 527-8675
Gateway (800) 846-2301
Sharp (800) 237-4277
Hewlett Packard (800) 474-6836
Sony (888) 476-6972
Toshiba (800) 457-7777
Samsung www.samsung.com
Hitachi www.hitachi.com

For loops not recognizing spaces properly

August 24th, 2008 . by Administrator

Speaking of learning something new every day… we all know that command
line tools and spaces don’t get along… but the way to make them behave
is to surround values containing spaces in quotes, right?

So the other day I’m writing this query to extract all users in my
active directory (easy enough: dsquery user -name * -limit 50000 | sort
> users.txt).

But all the names had spaces in them and my next query, to list all the
groups each user was in (for /f “delims=~” %%i in (users.txt) do echo
%%i >> foreachuser-showgroupmembership.txt && cscript //nologo
EnumGroup.vbs %%i >> foreachuser-showgroupmembership.txt) kept bombing
out on the spaces.

So after banging my head against the wall for a couple hours, it dawns
on me to look at the help file for the FOR command.

The trick is to define a delimiter that the program will never find…
so since I knew there weren’t any ~s in the names, I set the delimiter
to ~ and re-ran the command.

This may come in handy again someday.

Get all groupnames (short):
dsquery group -limit 50000 -o samid | sort

Get all groupnames (distinguished name):
dsquery group -limit 50000 | sort

Get all users:
dsquery user -name * -limit 50000 | sort

Get all users in each group:
for /f “delims=~” %%i in (groups-SHORT.txt) do echo %%i >>
foreachgroup-showitsmembers.txt && dsquery group -name “%%i” | dsget
group -members >> foreachgroup-showitsmembers.txt && type crlf.txt >>
foreachgroup-showitsmembers.txt

Get all groups that each user is in:
for /f “delims=~” %%i in (users.txt) do echo %%i >>
foreachuser-showgroupmembership.txt && cscript //nologo EnumGroup.vbs
%%i >> foreachuser-showgroupmembership.txt && type crlf.txt >>
foreachuser-showgroupmembership.txt

I didn’t know anyone used the Services file anymore

August 24th, 2008 . by Administrator

So, just like hosts and lmhosts, there is a file in
\windows\sytem32\drivers\etc names ’services’.

Now I’ve been building and maintaining PCs and networks for about 20
years and have never had to touch this file… but last week I finally
needed it.

There was an application trying to talk to a service named OLCCA… what
the hell is OLCCA? Beats me, but the developer told me it used tcp port
8562.

But how does “OLCCA” get translated to 8562? I’m glad you asked… by
defining it in the services file like this:

OLCCA 8562/tcp

You learn something new every day… if you’re paying attention.

Firewall service won’t start in Vista

August 24th, 2008 . by Administrator

Ran in to an interesting problem last week… the firewall on a Vista
machine wouldn’t start. Every time you tried to start it it would fail
with a “service specific error code 5″.

With not much to go on I scoured Google and support.microsoft.com but
came up empty - for a while. Then I ran across this article:
http://support.microsoft.com/kb/943996 - “Some services do not start in
Windows Vista”.

The error means “Access is denied”. This may happen if the “MpsSvc”
account doesn’t have the necessary permissions for the related registry
keys.

The NT Service\MpsSvc account needs permissions for the following keys:

1) HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\
SharedAccess\ Epoch: Query Value;Set Value

2) HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\
SharedAccess\ Parameters\ FirewallPolicy: Full Control;Read

3) HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\
SharedAccess\ Defaults\ FirewallPolicy: Full Control;Read

Sounded like a long-shot, but sure enough, MpsSvc had no permissions to
one of the three keys and when I added it back in, it worked. No reboot
was necessary.

USB GPS woes…

July 4th, 2008 . by snoel

So I go to install a new USB GPS receiver and the install CD that comes with the device is calling for a driver - ser2pl.sys. Odd that it wouldn’t be on the driver CD - but ok, I’ll go find it and download it from the web.

After a quick Google search I go to a couple sites and end up at floridaprobe.com and voila - I have myself a copy of the driver. Now I can install the driver and see the device in Device Manager. But my navigation software still doesn’t see any data, and as an added bonus my machine has learned how to BSOD with a root cause of ser2pl.sys. Great.

Back to Google I go, following the rabbit hole to a bunch of message boards who all tell me to visit tech.prolific.com.tw to get version 2.0.2.8 of the same driver (the one from Florida Probe was version 1.3.0.1). That site is no longer good, and you get redirected to the “new” support site. Seems promising, but no joy - the file doesn’t actually appear to be downloadable from their site - at least not from the section marked Downloads for GPS - where you might expect to find it.

But, if you go to the section for USB, I/O Port Controllers, PL2303 you can download the file you need. Here’s the link directly to the file: http://www.prolific.com.tw/ support/ files/ /IO%20Cable /PL-2303HX /Drivers /Generic /PL2303_XP2KME98Driver_Setup.zip

The Download page has more versions (64 bit, Mac, etc.) but they don’t seem to support Vista.

You can also try downloading the ser2pl.sys directly from here.

DNS caching and ISA

June 18th, 2008 . by snoel

If you have strange name resolution on your network, it could indicate a DNS poisoning, DNS hijacking, or it could just be that you need to clear your cache.

First, check your DNS forwarders to make sure they are set up appropriately. If you don’t trust your DNS provider, or have any reason to suspect they may be having an issue, you can temporarily change your forwarders to a public DNS server (recently I’ve been really digging OpenDNS (208.67.222.222 and 208.67.220.220 - but there are certainly others out there). Once you get things straightened out you can always switch back to whoever you had originally.

A good place to start, though, is to clear out all your caches. Here are some of the places you might need to check for (and clear) the bad entries:

– Your local cache (ipconfig /flushdns)
– Your AD Domain Controllers (Go to the DNS console, turn on advanced view, right click on the cache and choose “clear cache”)
– Your ISA server (you must use the command line tool dnstools /c - you need to download this from Microsoft - search for dns cache tool for isa or look at isatools.org)
– Other proxy-like appliances installed in your enviroment

As always, when trying to solve this type of problem, “be the packet”: follow the path from you to the Internet and leave no stone unturned along the way.

Calculate Potential Savings From Power Managing Your Computers

June 14th, 2008 . by Administrator

Do your force the PCs in your office to shut down when not in use? If you do you can save money on the electricity you consume and pay for, but will lose some manageability of the PCs. Best bet is probably a hybrid approach - set the monitors to go to sleep and leave the PCs on all night - or at least most of the night.

Use this calculator to estimate your energy and dollar savings from activating power management on your computer monitors and your PCs. Enter the number of units to be power managed and the price of electricity (a national commercial average of 7.1 cents per kWh is the default).

http://pmdb.cadmusdev.com/powermanagement/quickCalc.html

« Previous Entries