Archive for 'windows'

Troubleshoooting device driver installation with setupapilog.txt

Today I tried to install the ”HP Universal Driver PCL6″ (32-bit) on a Windows XP machine with WMI and VB.NET. All I got was the errorcode 2 and a failed installation. What does that mean? Windows errorcodes is not my (anyones?) speciality…

After some googling I found this very good post that describes the problem and a possible solution.

The key to solving this puzzle and possibly other device installation problems is the file setupapi.log in the windows folder. After running my code again I got this in my setupapi.log file (in swedish):

[SetupAPI Log]
OS-version = 5.1.2600 Service Pack 3
Plattforms-ID = 2 (NT)
Service Pack = 3.0
Svit = 0x0100
Produkttyp = 1
Arkitektur = 2006157608
[2010/01/22 14:20:41 5392.4 Driver Install]
#-198 Bearbetad kommandorad: C:\WINNT\system32\wbem\wmiprvse.exe
#I060 Ange vald drivrutin.
#I060 Ange vald drivrutin.
[2010/01/22 14:20:41 5392.5]
#-198 Bearbetad kommandorad: C:\WINNT\system32\wbem\wmiprvse.exe
#-167 SPFILENOTIFY_NEEDMEDIA: Tagg = p6i2svww.cab, Beskrivning= PDL_LANG, Källsökväg = C:\CentralPrintArea\FKPrint\HP\Universal\32bit\HP Universal, Källfil = UNIDRV.HLP, Flaggor = 0x00000000.
#E169 SPFILENOTIFY_NEEDMEDIA: returnerade FILEOP_ABORT. Fel 2: Det går inte att hitta filen.
#W187 Installationen misslyckades. Försök att återställa originalfiler utförs.

It says that I got an errorcode 2 (missing file) and which file that is missing. In this case it is missing the file ”UNIDRV.HLP” that is not available in swedish. All I had to do is to extract this file from the cab-file ”p6i2svww.cab” to the root of the driverfolder. After doing this and running the program once more everything is working and the driver installs. After this I get the following output in setupapi.log.

[SetupAPI Log]
OS-version = 5.1.2600 Service Pack 3
Plattforms-ID = 2 (NT)
Service Pack = 3.0
Svit = 0x0100
Produkttyp = 1
Arkitektur = 2006157608
[2010/01/22 14:28:43 4784.4 Driver Install]
#-198 Bearbetad kommandorad: C:\WINNT\system32\wbem\wmiprvse.exe
#I060 Ange vald drivrutin.
#I060 Ange vald drivrutin.

That looks good I suppose! At least better then before. And the driver is installed ok!

You can read and download information about setupapilog.txt at the Microsoft website. If you read the whitepaper you could possibly solve many kinds of STRANGE device driver installation problems.

This is Microsofts description of setupapilog.txt

Windows XP and later versions log system operations more extensively than previous versions of Windows do. One of the most useful log files for debugging is the SetupAPI log file (setupapi.log). This plain-text file maintains the information that SetupAPI records about device installation, service-pack installation, and hotfix installation. Specifically, the file maintains a record of device and driver changes, as well as major system changes,

If you wnat more verbose logging to the setupapi.txt file you can edit the windows registry key ”HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\LogLevel”. If you raise this value to 255 you get a lot of logging which can be useful at times.

I hope this helps someone and that HP fixes the broken driver. It must be some sort of localization problem within this driver. Or maybe that I have the wrong driver…

There is always something new to learn in the Windows world! Happy troubleshooting!

How to create a printerqueu with .NET and WMI

This is an example of how you create a printerqueue with .NET and WMI (Windows Management Instrumentation).

A list of properties can be found at MSDN Win32_Printer

Other topics:
How to install printerdrivers with wmi and VB.NET
How to create TCP/IP printerports with .NET

Imports System.Management

Dim shared as Boolean = true

Try
 Dim mp As ManagementPath = New ManagementPath("Win32_Printer")
 Dim co As ConnectionOptions = New ConnectionOptions()
 co.EnablePrivileges = True
 co.Impersonation = ImpersonationLevel.Impersonate

 Dim ms As ManagementScope = New ManagementScope("\\" + Environment.MachineName + "\root\cimv2", co)

 Dim printerObject As ManagementObject = New ManagementClass(ms, mp, Nothing).CreateInstance()
 printerObject("PortName") = "IP_192.168.0.2"
 printerObject("DriverName") = "DriverName"
 printerObject("DeviceID") = "queuename"
 printerObject("Location") = "Placement of printer"
 printerObject("Comment") = "Some comments"

 If (shared) Then
  printerObject("Shared") = True
  printerObject("ShareName") = "Sharename"
  'printerObject("Published") = False ' Publish printer
 End If

 Dim options As PutOptions = New PutOptions()
 options.Type = PutType.UpdateOrCreate
 printerObject.Put(options)

Catch ex As Exception
 ' Do something
End Try

Install printerports with WMI and VB.NET

This is an example of how you install TCP/IP printerports with .NET and WMI (Windows Management Instrumentation).

A list of properties can be found at MSDN Win32_TCPIPPrinterPort

Other topics:
How to install printerdrivers with wmi and VB.NET
How to create a printerqueu with .NET and WMI

Imports System.Management

Try
  Dim mp As ManagementPath = New ManagementPath("Win32_TCPIPPrinterPort")
  Dim co As ConnectionOptions = New ConnectionOptions()
  co.EnablePrivileges = True

  Dim ms As ManagementScope = New ManagementScope("\\" + Environment.MachineName + "\root\cimv2", co)

  Dim port As ManagementObject = New ManagementClass(ms, mp, Nothing).CreateInstance()
  port.SetPropertyValue("Name", "portname")
  port.SetPropertyValue("Protocol", 1)
  port.SetPropertyValue("HostAddress", "10.15.12.12")
  port.SetPropertyValue("PortNumber", "9100")

  Dim po As PutOptions = New PutOptions()
  po.UseAmendedQualifiers = True
  po.Type = PutType.UpdateOrCreate
  port.Put(po)
Catch ex As Exception
  ' do something
End Try

Marvel 6162 SATA driver for Windows 7

There isn’t any driver for the Marvel 6162 (88SE6162) SATA controller in Windows 7 (32-bit). For my motherboard (Asus M2V) I needed this driver and I could not find them on the Asus support website. I guess Asus havn’t made these available yet. Lazy bastards! After some modifications to the Vista-drivers I could use them instead.

marvel-6162-sata-driver

If you download and try to install the Vista-drivers you get a message like ”Does not support this Operating System : WNT_6.1P_MCE”. To be able to run the installer you need to edit the AsusSetup.ini file with notepad. The only thing you need to do is add a line corresponding to your Operatingsystem (WNT_6.1P_MCE) in the [OS_Language_Tag] section of the file.

I have prepared a file for Windows 7 32-bit that you can use:
Download Marvell_SATA_V10215B2 driver.

You only have to extract the files and run the AsusSetup file in the driver/x32 folder. If you run Windows 7 64-bit you can use the same files and make the same changes. If someone does this then please contribute to this post.

The driver installer then works great and the drivers are working. My SATA-drive has appeared and I am happy again.

Problem installing Windows 7 on Asus motherboards

For the last 5 hours I tried to install Windows 7 (x86, 32bit) on my home computer that has an Asus M2V motherboard. I tried everything in the book and couldn’t install it. I removed and switched hardware, reburned the DVD, updated the BIOS and did everything that I could possibly think of. The installation process always hung when the installer says ”expanding windows files”. No error messages or nothing and the installation percentage counter stops at a random number. That really pissed me of!

Finally I found an answer to this really weird behaviour. It seems that this is common problem on Asus motherboards and Windows 7.

In BIOS you have to make these changes to make it work:
* Enable the floppy drive (I had it disabled because I dont have a floppy drive).
* Disable the ”Cool and quite” feature.

After I made these changes the installation worked!

I hope this helps other people stuck with the really annoying ”Windows 7″ installer.

Install printerdrivers with WMI and VB.NET

This is an example of how you install printerdrivers with .NET and WMI (Windows Management Instrumentation). Most examples on the Internet shows how this can be done with vbscript, printui.dll and such…

A list of properties can be found at MSDN Win32_PrinterDriver

Other topics:
How to install printerports with WMI and VB.NET
How to create a printerqueu with .NET and WMI

Imports System.Management

Dim infPath  as String = "c:\driver\printerdriver.inf"
Dim mp As ManagementPath = New ManagementPath("Win32_PrinterDriver")

Dim co As ConnectionOptions = New ConnectionOptions()
co.EnablePrivileges = True

Dim ms As ManagementScope = New ManagementScope("\\" + Environment.MachineName + "\root\cimv2", co)

Dim mcPrinterDriver As New ManagementClass(ms, mp, Nothing)
mcPrinterDriver.SetPropertyValue("Name", "drivername")
mcPrinterDriver.SetPropertyValue("SupportedPlatform", "Windows NT x86") ' x86-architecture
'mcPrinterDriver.SetPropertyValue("SupportedPlatform", "Windows x64") ' x64-architecture
mcPrinterDriver.SetPropertyValue("Version", 3)
mcPrinterDriver.SetPropertyValue("FilePath", System.IO.Path.GetDirectoryName(infPath))
mcPrinterDriver.SetPropertyValue("InfName", infPath)

Dim inParams As System.Management.ManagementBaseObject = Nothing
inParams = mcPrinterDriver.GetMethodParameters("AddPrinterDriver")
inParams("DriverInfo") = CType(mcPrinterDriver, System.Management.ManagementBaseObject)
Dim outParams As System.Management.ManagementBaseObject = mcPrinterDriver.InvokeMethod("AddPrinterDriver", inParams, Nothing)

Dim uiReturnValue As UInteger = System.Convert.ToUInt32(outParams.Properties("ReturnValue").Value)

I have tested this in Windows XP, Windows 7 and Windows 2008R2. Make sure your account has privileges to install drivers.

On Windows XP the drivers are installed physically to:
C:\WINNT\system32\spool\drivers

And in the registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments

Boost performance on your Asus EEE 900

My sister has the Asus eee 900 netbook, the one with 16GB SSD hard drive, and Windows XP. The performance on the machine was very very bad. The bottleneck was the SSD-drive that made the machine hang when there were (m)any writes to it. I have made all optimizations that you can do on Windows XP, like disabling all services that aren’t needed. However, the machine was still slow. While browsing the eeeuser forum I found the magical solution in one of the threads….

asus-eee-pc-900

The solution was to install Flashfire SSD Accelerator. FlashFire is a software for Solid-State Drives and uses host RAM to enhance random write performance of a SSD. Read more about other peoples success-stories in the eeeuser forum.

After installing Flashfire the computer is fast as hell and has no hangups. It is such a miracle! I highly recommend this piece of software for all people with netbooks that has slow SSD-drives.

Mid Sweden Technology Conference i Sundsvall

Den 9 september så var jag på Mid Sweden Technology Conference på Folkets Hus här i stan. Det var en trevlig tillställning som arrangerades av Åkroken Science Park AB. Man förklarade att det skulle bli en återkommande konferens med fokus med utveckling och teknik inom Microsoft-området och denna gång så låg fokuset på ”Windows 7″.

Programmet var följande:

08.00-08.30 Registrering

08.30-09.30 Arbeta smart (Nils Morén, XLENT)

09.45-10.45 Nytt försäkringssystem i .NET (Thomas Hellström, SPV)
Thomas Hellström är ansvarig arkitekt i ett pågående projekt på Statens Pensionsverk som syftar till att utveckla ett nytt försäkringssytem med den största delen på .NET plattformen. Thomas kommer berätta om de utmaningar som ställs på ett sådant system och de tekniska lösningar som valts.

11.00-12.15 Azure (Johan Lindfors, Microsoft)
Windows Azure består också av tjänster som SQL Azure och .NET Services. Dessa kan användas både i molnet och från lokalt installerade applikationer. Här visar vi på exempel och demonstrerar teknikerna som redan idag finns tillgängliga för utvecklare!

12.15-13.15 Lunch

13.15-14.00 Windows 7 (Magnus Jungåker, Microsoft)
Windows 7 är ett modernt operativsystem som alla kan använda och företag sparar mycket på att rulla ut som standartklient. Vi har fokuserat på att utveckla de fundamentala egenskaperna som prestanda, kompatibilitet, säkerhet och stabilitet. Vi lägger också till funktionerna DirectAccess och BranchCache. Vi har förbättrat sök och hårddiskkrypteringsfunktionerna. Men vi har framförallt gjort ett operativsystem som gör användaren mer produktiv och företaget effektivare.

14.15-15.15 Virtualization (Magnus Jungåker, Microsoft)
Med Live Migration i Windows Server 2008 R2 och Server Management Suite Datacenter har Hyper-V blivit en mogen och fullfjädrad servervirtualiseringslösning. På klientsidan har Microsoft i Desktop Optimization Pack (MDOP) och Virtual Enterprise Centralized Desktop(VECD) alla teknologier på plats för att även virtualisera klientsidan.

15.30-16.45 Rika klienter (Robert Folkesson, Microsoft)
I den här sessionen visas hur rika klienter kan dra nytta av ny funktionalitet i Windows 7 som Taskbar notifications, Jump Lists och federerad sökning. Vi visar också de nya möjligheterna som Multi-touch ger och undersöker hur stödet för detta kommer att se ut i .NET Framework 4 och Windows Presentation Foundation.

17.00-18.00 RIA Arkitektur (Fredrik Normén, Cornerstone)
Fler och fler affärs applikationer flyttas till målnet , fler och fler användare vill a bättre användarupplevelse. Enligt Gartner Research, så är 60% av all nya applikationer skapade som RIA under 2010. I denna session så får du lära dig hur arktietkturen för en RIA kan se ut, vad man bör tänka på etc när man utvecklar RIA.

windows7

Mina Synpunkter
Jag tycker att det var intressant att lyssna på Thomas Hellström från SPV och hans tankar om deras .NET utvecklingsprojekt. Han undertryckte bla. vikten av att testa sina ideer med proof-of-concept lösningar, och det är något som jag själv gillar väldigt mycket. Det är viktigt att testa sin design med en enkel modell innan man börjar bygga något stort.

Sedan så var det intressant att höra föreläsarna från Microsoft tala om nyheter i Windows 7. Eftersom jag själv nyligen börjat köra sjuan efter att ha hoppat över Vista så fick jag lära mig en hel del nyheter inom såväl operativsystem som sådant samt om utvecklingsbitarna, virtualisering, paketering och licenser.

Här kan du läsa om Robert Folkessons Presentation från Mid Tech-konferensen i Sundsvall . Där hittar man även material för nedladdning.

I det stora hela så var det en bra dag, även om vissa delar inte passade mig. Det blev lite väl stor spridning på de ämnen som diskuterades. För att passa mig bättre så skulle jag år vilja se att man delar upp konferensen på två dagar. Ena dagen med utvecklingsrelaterade ämnen och den efterföljande dagen med mer driftrelaterade ämnen. Samt att man får välja om man vill gå en eller två dagar.

Run advertised programs

When you use the classical view of the control panel in Windows XP the ”Run advertised programs” icon doesn’t show up. However, it shows up when you use the ”windows xp theme”. This is happening for my computer at work which uses features from the company’s SMS setup. Perhaps our SMS-guys have done a bad job or this problem is a bug.

If you have this problem you should try this command from the command prompt or from ”run…” in the start-menu:

RunDLL32.EXE shell32.dll,Control_RunDLL %WINDIR%\system32\ccm\smsrap.cpl

This should start the ”run advertised programs” software.

Radera tom sida i Word

Dagens andra Word tips är en förklaring om hur man kan ta bort en tom/blank sida i Word som vägrar att försvinna och som inte går att få bort på något av de vanliga sätten. Det fanns heller inga gömda formatteringar på sidan. I mitt fall fanns den tomma sidan sist i mitt dokument. Varför den hamnat där och varför den var helt omöjlig att ta bort är för mig oförklarligt. På något sätt hängde det ihop att min sista sida enbart bestod av en lista med slutkommentarer. Jag lyckades till slut radera sidan genom att göra följande:

1. Välj att förhandsgrandska dokumentet.
2. Bläddra fram den tomma sidan så att den syns i förhandsgranska fönstret.
3. Välj i menyn: Redigera -> Radera -> Format
4. Om inte det funkar så välj Redigera -> Radera -> Innehåll
5. Vid det här läget borde den tomma sidan vara borta.