Saturday, May 23, 2009

Windows 7 RC User Profile Service Failed the Logon

I upgraded my laptop the other day to use Windows 7 RC.  I am really liking the speed improvements and the windows virtual pc that it comes with. Dont forget to enable virtualization on your microprocessor in your computer's bios settings if you want to use windows virtual pc.

 The other day after the upgrade I was not able to log into my account. I got an message User Profile Service Failed the Logon.   The error was caused by a messed up registry key for the user profile for my account.  Well I was able to boot into safe mode and follow the instructions in this post in the Windows Vista Forums and fix the problem.  

Thursday, March 26, 2009

Getting Windows Mobile Device ID

I got email today asking me how to get the device ID from a pocket pc with vb

?
Imports System.Text
 
Public Class Form1
 
    <System.Runtime.InteropServices.DllImport("coredll.dll")> _
Private Shared Function GetDeviceUniqueID(ByVal appdata As Byte(), ByVal cbApplictionData As Integer, ByVal dwDeviceIDVersion As Integer, ByVal deviceIDOuput As Byte(), ByRef pcbDeviceIDOutput As Integer) As Integer
    End Function
 
    Private Function GetDeviceId(ByVal appData As String) As Byte()
 
        Dim appDataBytes As Byte() = System.Text.Encoding.ASCII.GetBytes(appData)
        Dim outputSize As Integer = 20
        Dim output(19) As Byte
 
        Dim result As Integer = GetDeviceUniqueID(appDataBytes, appDataBytes.Length, 1, output, outputSize)
 
        Return output
 
    End Function
 
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim sbId As New StringBuilder
 
        Dim bID() As Byte = GetDeviceId("MyAppName")
 
        For Each b In bID
            sbId.Append(String.Format("{0:x2}", b))
        Next
 
        Debug.WriteLine(sbId.ToString)
    End Sub
End Class