Friday, December 31, 2010

IIS 6 - Service Unavailable Error

Early this morning a team member found one of our 2003 web servers were throwing a Service Unavailable response.  I connected to the machine to see what was going on.  My team member had tried restarting the web site and the web server service but that didn't get it going.  These were the two most obvious things to try, so, I began checking other issues.

I Googled a little and found that the AppPool might need cycling.  When I checked the AppPool associated with the specific web application I saw that it was disabled.  That was odd.  I started it and it quit shortly after I resumed the AppPool.  Next, I began checking the event logs.  There were two obvious error sets I needed to deal with.  First, I had about five 1009 errors.  Then, I had one 1002 error.  The 1009 errors were notifying me that the process running the AppPool in question failed with an error 0x80.  The 1002 error indicates that the AppPool was being disabled.  Here are the actual errors (with a little editting to prevent any good info from being given away).

Error 1009 text
Event Type: Warning
Event Source: W3SVC
Event Category: None
Event ID: 1009
Date: 12/31/2010
Time: 9:13:10 AM
User: N/A
Computer: MYCOMP
Description:
A process serving application pool 'AppPool' terminated unexpectedly. The process id was '4668'. The process exit code was '0x80'.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Error 1002 text
Event Type: Error
Event Source: W3SVC
Event Category: None
Event ID: 1002
Date: 12/31/2010
Time: 9:13:10 AM
User: N/A
Computer: MYCOMP
Description:
Application pool 'AppPool' is being automatically disabled due to a series of failures in the process(es) serving that application pool.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
If found a post on the IIS blogs which pointed out several things their support teams use to get sites going again:
http://blogs.iis.net/brian-murphy-booth/archive/2007/03/22/how-to-troubleshoot-an-iis-event-id-1009-error.aspx 

Fedora - Reset Root Password

I have an old laptop I am trying to convert into a fully functional wireless unit for my wife.  I installed Fedora a while back...long enough ago to have forgotten the password.  So, I went to find out how to crack (or reset) the root password.  I tried Knoppix, but, I didn't have time to brute force the password.  Instead, I found this link:
http://www.go2linux.org/fedora-centos-root-password-recovery
A quick synopsis of this link follows:

  1. Boot your machine.  When the Fedora Core screen appears, press 'e' and hit Enter.  This causes a screen listing the images on the machine to be listed.
  2. When you see the list of images, select the kernel line, type 'e' and hit Enter.  This brings up a limited bash screen which allows you to modify the boot configurations.  
  3. Type '1' to the end of the kernel boot config line and hit Enter.
  4. Next, hit 'b' and Enter.  The system will reboot and enter single user mode.
  5. Once it boots type passwd and hit Enter.  You will then be prompted to enter (and re-enter to confirm) the new root password.
  6. Now that the password has been reset, type reboot and hit Enter.  The system will restart and you will be able to use the new password.
Here is another post indicating how to change other user passwords, provided you know the root password.  It also provides a real quick summary of how to do the steps listed above in case my explanation is too wordy.
When the login banner appears, hit Ctrl+Alt+F1 to get a console. Login in as root and use
# passwd username
to change the user account's password. If you've forgotten your root password (meaning you're probably really desperate), at the grub splash screen, instead of hitting [enter] to boot your kernel, hit e to edit the boot options. Then select the line that begins with kernel and hit e again. Add the word single to the end of the line. Hit [enter] followed by b. The system will now boot into singleuser mode. Run passwd to change your root password and passwd username to change your user password.

Tuesday, December 21, 2010

Cmd Script - Get All Machines in Domain

To try and double check a Powershell output I wanted to come up with a second approach to see what machines were on a domain with cmd shell.  Mueller's Windows Administration at the Command Line for Windows Vista, Windows 2003, Windows XP, and Windows 2000 has a nice script that I tweaked a bit:
From this I got a nice little list of machines I could work with.

for /f "tokens=2 delims==," %H in ('dsquery computer') do @echo.%H

Monday, December 20, 2010

Utility - Mklink (Windows 7)

I had gotten a trial order for Carbonite and wanted to see if I could get a work around.  I figured the answer was no, but, thought, it is possible to use a symbolic link to reference an external drive.  By default, the 15-day free trial does not allow you to reference anything other than your %homedrive%, aka, C:, in Windows.  To test this theory I used the mklink command.  You will not find any mklink.exe on your drive.  It's stored in the cmd.exe on a Windows 7 Enterprise cmd.exe at line 000236B8: 4D 00 4B 00 4C 00 49 00 4E 00 4B 00 (M.K.L.I.N.K.).  At any rate, the help for this command is listed as:
The syntax of the command is incorrect.
Creates a symbolic link.

MKLINK [[/D] | [/H] | [/J]] Link Target

/D Creates a directory symbolic link. Default is a file
symbolic link.
/H Creates a hard link instead of a symbolic link.
/J Creates a Directory Junction.
Link specifies the new symbolic link name.
Target specifies the path (relative or absolute) that the new link
refers to.
To start off I ran this command:
mklink /d c:\link f:
symbolic link created for c:\link <<===>> f:\
When I explored the C:\ directory a link icon now existed.  I could tell it was a symbolic link because instead of a regular folder icon it had an arrow.  You can see the same kind of icon in Windows 7 if you look at the Libraries\Documents folder and check out the My Music icon.  

Next, I tried to add a hard link, but, that failed with my F: drive as it is an FAT 32 volume:
mklink /d /h c:\link f:\
Local NTFS volumes are required to complete the operation.
To get an idea of what the difference was I ran the same command against a real NTFS volume B:.
C:\>mklink /d /h C:\link2 b:
The system cannot move the file to a different disk drive.
That did not work, so, I tried the J (junction switch):
C:\>mklink /j C:\link2 "c:\new folder"
Junction created for C:\link2 <<===>> c:\new folder
After having that work, I retried the /h switch to get an access denied error.

Wednesday, December 8, 2010

Scheduled Tasks - Error 0x80070569: Logon failure

I was wondering why some scheduled tasks has not sent notification emails this morning.  I connected to my remote server and checked the scheduled tasks services log.  It has several entries similar to this:
"Daily-Powershell-Get-BackupFileCount.job" (powershell.exe) 12/8/2010 12:15:00 AM ** ERROR ** The attempt to log on to the account associated with the task failed, therefore, the task did not run. The specific error is: 0x80070569: Logon failure: the user has not been granted the requested logon type at this computer. Verify that the task's Run-as name and password are valid and try again.
A quick Google search turned up this link:
http://www.chicagotech.net/Q&A/windows1.htm
Their suggestion was:
To fix the problem, grant the local Administrators group the Right to log on as a batch job. e.g.: go to Administrative tool > Local security policy > Local Policies > User Rights Assignment > Logon as a batch job > Add.
NOTE: This behavior occurs even if you are logged on to the Domain Controller as an administrator.
After our system admin on that domain made the policy change I ran a quick gpupdate /force and it took care of the issue.

Powershell - Get IP of All Machines in Domain

Taking this script to get the machines in a domain a bit further:
http://learningpcs.blogspot.com/2009/12/powershell-get-all-computers-in-domain.html
I decided to figure out what the corresponding IP addresses went with these machines.
$strCategory = "computer"
$objDomain = New-Object System.DirectoryServices.DirectoryEntry
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.Filter = ("(objectCategory=$strCategory)")
$colProplist = "name"
foreach ($i in $colPropList){$objSearcher.PropertiesToLoad.Add($i)}
$colResults = $objSearcher.FindAll()
$objList
foreach ($objResult in $colResults)
{$objComputer = $objResult.Properties; $objList += $objComputer.name}
$objList | % {[System.Net.Dns]::GetHostByName($_) | select addresslist}