Kindle 3 Crash Update

Well I will have to say Amazon.com does have very good customer support, and they did get my replacement kindle the next day. Also transfering my Books, and Collections was easy, and I only needed my computer to update my Amazon account.

Mailed back the broken Kindle, and they should get it back within the week. So far the new kindle is working fine. At this point I think it might have had something to do with the built in PDF reader and how it handled the document I was reading. I’ll keep an eye out for it, but for now I’ll limit what documents I read for now until a new update confirms and fixes the issue.

Advertisements

A Function to detect Holidays in your VBS Script

This is basically a function that checks if the current date is listed in a text file and then returns a true or False. The txt file should have a list of holiday dates.

' FileOpen iomode Values 
Const fsoForReading = 1 
  
' holiday Filename 
Const sHolidays = "c:\scripts\holiday.txt" 
  
Function IsHoliday(ByVal vDate) 
  
    Dim fso, file, sLine, bReturn
  
    bReturn = False 

    ' Create FileSystemObejct 
    fso = CreateObject("Scripting.FileSystemObject") 
  
    ' Open text file 
    Set file = fso.OpenTextFile(sHoliday, fsoForReading) 
  
    Do While (Not (file.AtEndOfStream)) And (Not bReturn) 
        sLine = file.ReadLine 
        If IsDate(sLine) Then 
            If DateDiff("d", vDate, CDate(sLine)) = 0 Then 
                bReturn = True 
            End If 
        End If 
    Loop 
    file.Close() 
  
    file = Nothing 
    fso = Nothing 
  
    IsHoliday = bReturn 
  
End Function

Here is how the holiday file should be formatted

25.12.2002
26.12.2002
01.01.2003
18.04.2003
21.04.2003
01.05.2003
11.05.2003
29.05.2003
09.06.2003
03.10.2003
25.12.2003

Kindle 3 Crash

My new Kindle 3 crashed today, did not even have a case on it at the time. Contacted Amazon Kindle Support, which at least was easy enough. First they had me make sure it was fully charged (only used it for 2 days so if it was the battery that would have killed the whole 1 month charge feature). Finally the second time I called they pretty much took me at my word, and are sending a new kindle overnight. Don’t have the new one yet, but hopefully I get lucky and no freezing.

I happend to be reading a PDF document at the time of the crash, so not sure if this could have caused the issue. A new firmware update is on the way, so hopefully this issue will be addressed.

Adding Multiple Cores in vSphere 4.0 4.1 4.x

Basically you still select the number of vCPUs, but then you would also set in the advanced setting a new row to define how many of these CPUs are divided into a single virtual Socket. This is an advanced setting in vSphere, you add a row for “cpuid.coresPerSocket” and set the value to 2, 4, or 8. In Vmware workstation it is a little more straight forward, but I guess VMware feels that system admins should be comfortable working with vmx files and configuring advanced settings like this.

Example:
If you have 8 vCPUs and you select 2 for the cpuid.coresPerSocket, that would equal 4 sockets with 2 cores each
If you have 8vCPUs and you select 8 for the cpuid.coresPerSocket, that would equal 1 socket with 8 cores
If you have 4vCPUs and you select 4 for the cpuid.coresPerSocket, that would equal 1 socket with 4 cores

Just remember the values need to be 2, 4, 8 in both values and the number of vCPUs needs to be divisible by the number of cores per socket (cpuid.coresPerSocket).

What flexibilities this adds to your Virtual Machine in vSphere is that on standard editions of Windows you can now see up to 8 cores, and most software is per socket not core. So for MS SQL for example you could have running on one socket that has 8 cores and only need one CPU license, otherwise if you don’t do use multicores you would need 8 licenses at around 8k each .

Read this KB for details on how to configure multiple cores and the exact requirements.
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1010184

The only real down fall is that you need to power off the VM to make this change, other than that it only takes a few second to configure.

Detecting Windows System Type in VBS Scripts

Sometimes you need to know what type of system your script is running on to ensure things run smoothly, here are a few tricks I found while looking for a few ways to accomplish this.There may be a better way, but this might be just enough to do the trick for you.
The three empty functions can be called and used within your scripts:
OsArchtecture() – x86 or AMD64 (basically 32bit or 64bit)
OsProductType() – Server or Workstation
OsVersion() – 2000, XP, 7, 2008, 2008 R2, etc…

 
' Detect System Processor Achitecture
' Vaild Values for OsType, x86 or AMD64
Function OsAchitecture ()
	On Error Resume Next
	Dim WshShell
	Set WshShell = CreateObject("WScript.Shell")
	OsAchitecture = WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE")
	On Error Goto 0
End Function
 
' Detect if the system the script is running on is a Server or a workstation
Function OsProductType ()
	On Error Resume Next
	Dim objWMI, objItem, colItems
    	Dim OSVersion, OSName, ProductType
	Set objWMI = GetObject("winmgmts:\\.\root\cimv2")
	Set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem",,48)
	For Each objItem in colItems
		ProductType = objItem.ProductType
	Next
	If ProductType = 1 Then
		ProductType = "workstation"
	Else
		ProductType = "server"
	End If
	OsProductType = ProductType
	On Error Goto 0
End Function
Function OsVersion ()
	On Error Resume Next
    	Dim objWMI, objItem, colItems
    	Dim ProductType
	Set objWMI = GetObject("winmgmts:\\.\root\cimv2")
	Set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem",,48)
	For Each objItem in colItems
		OSVersion = Left(objItem.Version,3)
		ProductType = objItem.ProductType
	Next
	Select Case OSVersion
		Case 5.0
			If ProductType = 1 Then
				OsVersion = "2000"
			Else
				OsVersion = "Server 2000"
			End If
		Case 5.1
			OsVersion = "XP"
		Case 5.2
			If ProductType = 1 Then
				OsVersion = "XP"
			Else
				OsVersion = "Server 2003"
			End If
		Case 6.0
			If ProductType = 1 Then
				OsVersion = "Vista"
			Else
				OsVersion = "Server 2008"
			End If
		Case 6.1
			If ProductType = 1 Then
				OsVersion = "7"
			Else
				OsVersion = "Server 2008 R2"
			End If
		Case Else
			OsVersion = "Unknown"
	End Select
	On Error Goto 0
End Function

VBS script sub routine to send e-mail

Needed something to send a e-mail from a VBS script when things were not going as planned, and thus came this sub. (If you plan to use this on a system with SMTP configured, then omit the configuration field lines)

 
Sub SendNotification (EmailFrom, EmailTo, EmailSubject, ErrorMessage, FileAttachment)
	Set Notify = CreateObject("CDO.Message")
 	With Notify
 		.From = EmailFrom
 		.To = EmailTo
 		.Subject = EmailSubject
 		.TextBody = ErrorMessage
 		.AddAttachment FileAttachment
 		.Configuration.Fields.Item _
 			("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
 		.Configuration.Fields.Item _
 			("http://schemas.microsoft.com/cdo/configuration/sendusing")="smtp.domain.com"
 		.Configuration.Fields.Item _
			("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 
		.Configuration.Fields.Update
 		.Send
 	End With
 	Set Notify = Nothing
End Sub

Just Change the smtp.domain.com to either the FQDN or IP of your mail server.

Here is an example of how to call the routine in your script:

 
  SendNotifcation _
"johndoe@domain.com", "janedoe@domain.com", "Error in Script", "Error In line 12", "c:\Logs.txt"