jamesoff.net




23
Oct
2007
0

Checking for another process before starting JKDefrag

A user on the JKDefrag forum was asking about not running JKDefrag if another process is running (as they don’t play nice together), so I whipped this up.

You’ll need PsList from SysInternals in your path somewhere.

Change the three SET lines to point to jkdefrag, give the parameters you want to use, and the name of the program to avoid. (Get the name of the program from PsList.)

The “>2 NUL” sends stderr to NUL to avoid printing the PsList banner. It works on Vista, not sure about XP/2003. If it doesn’t just remove it and live with the PsList banner showing up.

Making this check for more than one process is an exercise for the reader. Also, you could use this with PsExec to check for the process on a remote host and then launch JKDefrag over there.

@echo off

REM Only run jkdefrag if another process is not running

REM Path to jkdefrag
SET JKDEFRAG=c:\jkdefrag\jkdefrag.exe

REM Options for jkdefrag
SET JKDEFRAGOPTS=-a 3

REM Process we don't want running
SET AVOID=explorer

 
REM Here we go!
 
pslist %AVOID% > NUL 2> NUL
if %ERRORLEVEL% == 0 goto skip

REM If we made it here, pslist didn't find the process
echo Couldn't find %AVOID% running, starting jkdefrag...
%JKDEFRAG% %JKDEFRAGOPTS%
goto end
 
:skip
echo %AVOID% is running, not running jkdefrag
 
:end




16
Apr
2007
0

Murdering dogs

I’ve been having some problems with the “Search Assistant” (the stupid dog thing in Explorer on Windows XP when you use the Find thingy) at work. For some reason recently opening the search sidebar results in Explorer crashing with a Data Execution Prevention error. Disabling the DEP stuff for explorer.exe just results in a regular crash. Alas, to disable the dog thing you need to be able to open the search panel… or just stick this in your registry.

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState]
 
"FullPathAddress"=dword:00000001
"Use Search Asst"="no"

Log off and back on again and the dog has been slaughtered.

Stupid yapping thing. :fuckoff:





29
Jan
2007
0

Setting localparts in Exchange Recipient Policies

It’s taken me too long to find this.

(For the uninitiated, Exchange Recipient Policies tell Active Directory how to automatically generate email addresses for your users.)

If you want to tell a recipient policy in Exchange 2003 (and presumably 2007) how to generate the localpart other then just username, use these expanos:

%s : Surname (last name)

%g : Given name (first name)

%i : Middle initial

%d : Display name

%m : Exchange 2003 alias

%rxy : Replace all subsequent characters x with character y in username. If x = y, the character will be deleted.

There are other things you can do like chopping the string to a certain number of characters, see the full article for details.

No longer will I have to manually add first.last@domain.com to every user I create :D

http://support.microsoft.com/Default.aspx?kbid=822447





16
Nov
2006
0

Assimilation complete

I knew this was coming, but seeing it happen makes me a sad panda.

http://www.sysinternals.com now redirects to a Microsoft :xbox: TechNet site. While the new site carries all of the stuff sysinternals.com had, and also has some new stuff (hooray!) it’s sad to see it finally gone :(

Luckily, nothing ever really dies on the Internet!





27
Oct
2006
3

“Access Denied” when joining a domain

While trying to join a machine which had previously been on a Windows Server 2003-hosted domain to a new domain hosted on Windows Server 2003 R2 (not sure if the change in OS is the cause of this issue), I kept getting “Access Denied”.

In C:\windows\debug\netsetup.log it says:

NetUseAdd to \\DC_FQDN\IPC$ returned 5
NetpJoinDomain: status of connecting to dc '\\DC_FQDN': 0x5
NetpDoDomainJoin: status: 0x5

The solution was to fire up regedit and change the value of HKLM\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters\enablesecuritysignature to 1, and restart.

Edit: Do this after leaving the original domain for a workgroup, because doing that resets it to 0.





5
Jul
2006
1

MS Word Reading Layout

Why is it that Word 2003 is so keen on Reading Layout? Even if you clear the “Allow starting in Reading Layout” checkbox in Options, it ignores you and turns it back on again. Gah(£$$)


Permalink | Posted in Microsoft 



31
Mar
2006
0

Exchange Offline Address Books

If your Exchange Offline Address Book isn’t generating and you get error 9335 in the Event log (”OALGen encountered error 8004010f while clearing the offline address list public folders under …”), try this:

http://b.oooom.net/1xo





2
Mar
2006
0

IE7 Tabbed Browsing

I’m trying out the latest beta of IE7 to make sure it works OK with stuff I do for my job, and the tab support in it is infuritating me.

In Firefox, I can drag the favicon from the address bar or a link from a page into a blank area of the tab bar, and I’ll get a new tab with my link it.

In IE, that opens in the link in the currently active tab.

OK, so how about if I drop the link over the “new tab” button? No, that opens the link in the active tab too.

Alright then, I’ll create a tab with the new tab button myself, and then I’ll drop the link into the blank tab.

Wait, no, that doesn’t do it either. The only way to open a link in a new tab is to Ctrl-click it. All of the other actions for opening a new tab make sense to me from a UI point of view, but just don’t work.


Permalink | Posted in Microsoft 



24
Feb
2006
1

Using dsquery to find inactive users in AD

While reading the study guide for 70-290 (Managing a Win2k environment) I was pleased to find you could use dsquery to find users in your AD who had been inactive for a certain amount of time. However, it failed to mention that your AD must be at the Windows Server 2003 functional level for this to work, else it will complain:

C:\>dsquery user -inactive 4 dsquery failed: The parameter is incorrect. Windows could not run this query because you are connected to a domain that does not support this query. type dsquery /? for help.

After raising the functional level from Windows 2000 to Windows Server 2003 it works without complaining, but doesn’t return any data - I guess it’s not even stored until you fix the functional level.


Permalink | Posted in Microsoft 



13
Jul
2005
0

Windows Installer “Overlapped I/O”

After updating Windows Installer on one of my Windows Server 2003 machines, it refused to run and no installations could take place.

http://forum.iamnotageek.com/t-1819088849.html indicates the fix (which worked for me) is to run: msiexec /regserver (from Start | Run is fine)