Archive

Archive for September, 2009

Internet explorer 7 wont launch

September 7, 2009 Andrew Morgan Leave a comment

Internet-Explorer-8Had a weird one over the weekend. A colleague of mine accidentally approved Internet Explorer 8 to all servers in our domain via wsus and it left our Citrix servers in a bit of a sad state. We set about removing it as soon as possible but after the uninstall / restart we were faced with this very strange problem. When we double clicked internet explorer on the desktop, the application wouldnt launch and a new shortcut to Internet Explorer would be created on the desktop.

We also had these logged every thirty minutes or so in the event logs:

Event Type:    Error
Event Source:    Userenv
Event Category:    None
Event ID:    1041
Date:        06/09/2009
Time:        21:50:38
User:        NT AUTHORITY\SYSTEM
Computer:    LPGPCTXXA0008
Description:
Windows cannot query DllName registry entry for {7B849a69-220F-451E-B3FE-2CB811AF94AE} and it will not be loaded. This is most likely caused by a faulty registration.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

And:

Event Type:    Error
Event Source:    Userenv
Event Category:    None
Event ID:    1041
Date:        06/09/2009
Time:        21:50:38
User:        NT AUTHORITY\SYSTEM
Computer:    LPGPCTXXA0008
Description:
Windows cannot query DllName registry entry for {CF7639F3-ABA2-41DB-97F2-81E2C5DBFC5D} and it will not be loaded. This is most likely caused by a faulty registration.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

If you face the above problems, delete the following registry keys and open internet explorer as an administrator:

“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions\{CF7639F3-ABA2-41DB-97F2-81E2C5DBFC5D}” /f
“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions\{7B849a69-220F-451E-B3FE-2CB811AF94AE}” /f
“HKEY_CLASSES_ROOT\CLSID\{871C5380-42A0-1069-A2EA-08002B30309D}\shell\OpenHomePage” /v legacydisable /f

That should fix that!

Categories: Administration

Enabling RDP on a server remotely.

September 4, 2009 Andrew Morgan Leave a comment

There’s very litte more annoying in a windows environment than having to go to a console of a server because some idiot has disabled remote administration on a server 2003/2000 server. I was in this situation recently and decided not to go to the console out of principle.

rdpon

I wrote the following program in order to get around this issue. Its called RDPon.exe and you can get it here:

With this you can:

  • Query RDP status
  • Enable RDP
  • Disable RDP

I have sealed it as an exe so that you can right click it and choose run as to get at your admin account easily.

Categories: Personal, Tools Tags: ,

Determining if a number is odd or even using a batch file

September 4, 2009 Andrew Morgan Leave a comment

Our challenge recently was seperating the reboots of our citrix servers to ensure that half of our farm is always available. This is particularly useful if you are a 24/7 house and need to know exactly what servers restart and when they restart.

So to begin, our server names consist of “servername00xx” where xx is the number of the server, the task at hand was to ensure that 0001, 0003, 0005 etc restarted on one night and 0002, 0004, 0006 etc restarted the second night. To do this i needed to use the system variable “hostname” and read the last digit in the name to determine if the number was odd or even.

To get determine whether a number is odd or even i used the following logic. If you divide an even number by 2 then multiply it by two you will get the same number back, e.g. 8/2 = 4, 4*2 = 8, 8 is equal to 8 .

An odd number in batch is treated as follows 9/2=4, 4*2=8 ,9 is NOT equal to 8.

Rem Begining Logic Check for even or odd server
for /f “tokens=1-2 delims=00″ %%a in (‘hostname’) do set compnumber=%%b
set /a divnumber=%compnumber%/2
set /a sum=%divnumber%*2

With the above excerpt, i set three variables, %compnumber% (which is the number after the 00), divnumber (a variable for the result of the computernumber divided by two) and sum, which is the resulting divnumber * 2.

This divides compnumber by 2 and multiplys divnumber by 2 setting the resulting number to sum.

Rem Running if checks
if %compnumber% NEQ %sum% goto odds
if %compnumber% EQU %sum% goto evens

This next step is our determiner:

If the number divided by two and multiplied by two is not the same as the original number, the number is odd, the if statement then sends the script to the odds labeled portion of our script.

If the number divided by two and multiplied by two is the same as the original number, well you get the idea, its even and jumps down.

:o dds
<—Do something for odd servers here—>
exit

:evens
<—Do something for even servers here—>
exit

Categories: Citrix, Scripting