Showing posts with label Windows 2008. Show all posts
Showing posts with label Windows 2008. Show all posts

Monday, April 25, 2016

Amazon Windows Activation Problems

Some of my instances recently started showing up with the black background with:
Error: 0xC004F074 The Software Licensing Service reported that the computer could not be activated. The Key Management Service (KMS) is unavailable.

I recall having done this a long time ago and searching around I found some old correspondence from back in 2011 with Amazon Support that involved activating with the external IP of their KMS servers. However this was what was giving me that error. Unfortunately, I did not make good notes of that so I was going to have to figure out again. Fortunately, Internet to the rescue, I found this: http://kwjblogs.blogspot.ca/2012/01/amazon-ec2-instance-windows-activation.html

... and recalled essentially doing this:
slmgr.vbs /skms 169.254.169.250
slmgr.vbs /ato

Done. Now I also have noted it.



Saturday, June 25, 2011

"Windows server features or role services required by this product are not enabled" when installing Office Web Apps

I was trying to install Office Web Apps on my SharePoint server farm and came across this error when I launched the installer: "Windows server features or role services required by this product are not enabled"

I checked all the prerequisites listed under the Hardware and Software Requirements (SharePoint Server 2010) and they are all there.

After a bit of head scratching, I decided to launch Server Manager and see what roles and features were installed. I clicked on Add Feature and it complained that another user was still configuring a role. It turned out that when I was enabling the Desktop Experience Feature using a different account, however that required a reboot and was waiting for that account to login again in order to continue the installation of Ink and Handwriting Services. Once I logged in, that feature was successfully enabled.

Then the prerequisite check succeeded.

Wednesday, April 20, 2011

Resizing Amazon EC2 Windows drives

The disk sizes that come with the Amazon Windows AMIs are a little small (35GB for a Windows 2008 R2). Since I am running demo servers I have not really been paying too much attention to laying out the disks properly. However, the 35GB disk is simply not enough so I had to resize it. This turned out to be surprisingly easy:
  1. Stop the instance
  2. Create a snapshot of the volume
  3. Create a new volume from that snapshot, specifying the new size
  4. Detach old volume from the instance
  5. Attach new volume to the instance
  6. Restart the instance
  7. Run diskpart and enter the following commands
    • select disk <disk number>
    • select volume <volume number>
    • extend
  8. Delete the old volume (unless you want to keep it as a backup)
Simple!

Wednesday, April 13, 2011

Parsing IIS logs with Powershell (because logparser not supported on Windows 2008)

I was very disappointed to find out that logparser is not supported on Windows 2008. So, I started to look for an alternative and found a TechNet post by Nick Goude on how to use Powershell to parse IIS logs.

I have, for the most part, simply lifted the code:


# Location of IIS LogFile
$File = "C:\inetpub\logs\LogFiles\W3SVC25824252\u_ex1104*.log"


# Get-Content gets the file, pipe to Where-Object and skip the first 3 lines.
$Log = Get-Content $File | where {$_ -notLike "#[D,S-V]*" }


# Replace unwanted text in the line containing the columns.
$Columns = (($Log[0].TrimEnd()) -replace "#Fields: ", "" -replace "-","" -replace "\(","" -replace "\)","").Split(" ")


# Count available Columns, used later
$Count = $Columns.Length


# Strip out the other rows that contain the header (happens on iisreset)
$Rows = $Log | where {$_ -notLike "#Fields"}


# Create an instance of a System.Data.DataTable
#Set-Variable -Name IISLog -Scope Global
$IISLog = New-Object System.Data.DataTable "IISLog"




# Loop through each Column, create a new column through Data.DataColumn and add it to the DataTable
foreach ($Column in $Columns) {
  $NewColumn = New-Object System.Data.DataColumn $Column, ([string])
  $IISLog.Columns.Add($NewColumn)
}


# Loop Through each Row and add the Rows.
foreach ($Row in $Rows) {
  $Row = $Row.Split(" ")
  $AddRow = $IISLog.newrow()
  for($i=0;$i -lt $Count; $i++) {
    $ColumnName = $Columns[$i]
    $AddRow.$ColumnName = $Row[$i]
  }
  $IISLog.Rows.Add($AddRow)
}


$IISLog

Now, if you save this to a file such as iislog.ps1, then you can run commands like:

.\iislog.ps1 | Select-Object csusername | Sort-Object -Property csusername | Get-Unique -AsString


Note, there are some glaring deficiencies:

  1. Parameterize the specification of log files
  2. Handle column name changes
  3. Handle extra headers (these are saved upon iisreset) - done
  4. Stream results back out so that they can be used in a pipeline

I hope to fix these soon, but need to get to sleep.

Tuesday, March 8, 2011

Loading and modifying the registry of a dead Amazon EC2 instance

In a recent post, I had to troubleshoot an issue with an Amazon EC2 instance not accessible via RDP after Windows Update and reboot. Back then, I didn't realize that I could have edited the registry of the unresponsive instance. Here is how to do it (Thanks to Nick Greising at Amazon for providing me with the steps). You will first need a repair instance in the same zone.
  1. Note down instance information such as instance ID, attached block devices (volumes), private IP address, associated elastic IP address
  2. Stop the instance
  3. Detach the root volume
  4. Attach the volume to repair instance 
  5. Login to the repair instance
  6. Bring the disk online (eg: drive E)
  7. Run regedit
  8. Go to HKLM
  9. Select File->Load Hive
  10. Browse to E:\Windows\System32\config
  11. Open the hive you want (eg: SYSTEM)
  12. Pick a Key Name (eg: System_old)
  13. Make whatever changes you need
  14. Select the root of the hive you just loaded and modified (eg: HKLM\System_old)
  15. Select File->Unload Hive
  16. [Optional: Note if you are running SharePoint you may need to set Ec2SetComputerName to Disabled so the machine does not change names on restart]
  17. Take the disk offline
  18. You can now logoff or close the connection to the repair instance
  19. Detach the volume from the repair instance
  20. Attach volume to original instance
  21. Start instance
  22. You will also need reconfigure your security groups as the internal IP address would have changed and to reassociate the Elastic IP Address.
Now, I could just plop in the steps from Amazon EC2 instance not accessible via RDP after Windows Update and reboot into step 13 and I can repair those unresponsive instances. Note that when the hive is loaded, there won't be a CurrentControlSet. However, you can look at the value of HKLM\System_old\Select\Current to determine which ControlSet to use. See the knowledgebase article What are Control Sets? What is CurrentControlSet? for details.


Wednesday, February 16, 2011

Amazon EC2 instance not accessible via RDP after Windows Update and reboot

For the last couple of days, I have been running into a problem where my Amazon EC2 instance is no longer accessible via remote desktop after a Windows Update and a reboot.

My process for setting up these servers is pretty straightforward: Install SQL 2008, Install SharePoint 2010 Prerequisites, Install SharePoint 2010, run Windows Update. I have done this a couple of dozen times now without any problems. Just a couple of days ago, I was finding that after the Windows Update and ensuing reboot, the server comes up, status is active, but it is not accessible via RDP or HTTP (just times out).

My first thought was that one of the more recent Windows Updates is incompatible Amazon EC2. Comparing my last successful installation with the latest Windows Update packages, I found that the following might be the culprit:


  • Cumulative Security Update for Internet Explorer 8 for Windows Server 2008 x64 Edition (KB2482017)
  • Platform Update Supplement for Windows Server 2008 x64 Edition (KB2117917)
  • Security Update for Windows Server 2008 x64 Edition (KB2393802)
  • Security Update for Windows Server 2008 x64 Edition (KB2479628)
  • Security Update for Windows Server 2008 x64 Edition (KB2483185)
  • Security Update for Windows Server 2008 x64 Edition (KB2485376)
  • Update for Windows Server 2008 x64 Edition (KB971029)
  • Windows Malicious Software Remove Tool x64 - February 2011 (KB890830)

So, I'd figure I would try again and leave out these specific updates, but upon reboot, my new instance would also be unaccessible via RDP or HTTP.

Perplexed and after a lot of searching, swearing, hair pulling, I came across this post: Avoiding RDP connectivity issues when running SharePoint 2010 on Amazon EC2. In particular, it mentions the Microsoft Article KB2379016: A computer that is running Windows Vista or Windows Server 2008 stops responding at the "Applying User Settings" stage of the logon process which describes the problem as being a deadlock in the Service Control Manager database. To break the deadlock, it is just a matter of forcing HTTP.sys depend on CryptSvc. This can be accomplished as follows:
  1. Run regedit
  2. Locate and the registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP
  3. Create a New, Multi-string Value: DependOnService
  4. Set a single value CRYPTSVC
So far so good. Maybe I'll get some sleep tonight.
 




Wednesday, January 19, 2011

Automated or remote installation of components on an Amazon instance

I am trying to figure out a way to either have an Amazon instance install various software components automatically right after launch or to execute commands to do those installations remotely.

I have done some searching and so far have found the following references.

AMAZON EC2 - Launch command on remote Windows machine, given admin credentials

Unattended Amazon EC2 Install Script - Unfortunately, this is for Linux. I would have to figure out how to write a Windows equivalent, if at all possible

Perhaps the Invoke-Command Powershell cmdlet would help.



Unfortunately, I don't have time to investigate further so I will have to come back to this later.