Jump to content

Script to detect pc type and install drivers


Recommended Posts

Hello All,

I am creating a master Ghost image for all our desktops. They are all Dells and range from OptiPlex GX1 to GX280's.

I would like to create a script that runs at the end of the ghosting that will read the pc model from the registry and then run the installes for the specific drivers for that machine.

I haven't done any scripting in windows (besides reading and writing registry keys).

I was wondering if somene could show me a script that would do this or point me to a website with isntructions to accomplish this.

Thanks,

MA

Link to comment
Share on other sites


I don't want to sound like a downer here, but if you don't really have any scripting experience, then you're going to be spending a long time on this. I spent many years programming when I was younger, then about 3 years ago decided I had to pick up on VBscript for a wide range of purposes. Even with my programming experience and 3 years under my belt with VBscript, this would definately take me a long while to construct and properly test.

In a very simplified nutshell, you're going to need to tap into WMI to read some of the system component information. You'll then need to program the various aspects of decision making based on whatever the script finds.

If you have a decent number of these desktops to install, my suggestion would be to either use RIS or an unattended CD/DVD. Couple either one with the BTS driverpacks. You'll save yourself a lot of time this way and IMO will end up with better installs. I "gave up the Ghost" long ago (lol) in favor of either of the two options I just mentioned. There's a lot of gotchas using SysPrep in conjuction with Ghost.

Link to comment
Share on other sites

  • 2 weeks later...

Hello everybody,

I was able to create a vbs script that runs at the first login and checks the computer model and installs the corresponding drivers.

Everything seems to run smoothly except that with GX270's and GX280's, the SM Bus Controller has a question mark on the device manager.

The chipset installer should take care of it but it seems that it is not installing correctly.

Does anyone have any suggestions?

I am attaching the script just in case you were wondering how to do it. You need to change the extension to .vbs for it to work (it wouldn't accept that extension to upload the file)

Thanks,

M

installs.txt

Link to comment
Share on other sites

Maybe you found this interesting:

'Automaticka instalacia ovladacov pre chipset a nastavenie biosu

'Martin Zugec

'12.7.2004

'20.9.2004

Option Explicit

On Error Resume Next

Dim objWMIService, objShell

Dim strBoard, arrayBoards, strInstallPath

Dim strTypPocitaca

Set objWMIService = GetObject("winmgmts:root\cimv2")

Set arrayBoards = objWMIService.InstancesOf("Win32_BaseBoard", 48)

Set objShell = Wscript.CreateObject("Wscript.shell")

strInstallPath = Left(WScript.ScriptFullName,Len(Wscript.ScriptFullName) - Len(WScript.ScriptName + "n")) & "\"

for each strBoard in arrayBoards

Select Case Trim(LCase(strBoard.Product))

Case "optiplex gx150"

'Wscript.Echo "OptiPlex GX150"

NainstalovanieChipsetu("gx150")

Case "00t606","02x378"

'Wscript.Echo "Optiplex GX260"

NainstalovanieChipsetu("gx260")

Case "0x1078","0r2472","0u1324"

'Wscript.Echo "OptiPlex GX270"

NainstalovanieChipsetu("gx270")

Case "0n4846","0968h","0g5611","0f7739"

'Wscript.Echo "OptiPlex GX280"

NainstalovanieChipsetu("gx280")

Case Else

Call OdoslanieMailu

'wscript.echo ". Nepodarilo sa nainstalovat ovladac pre chipset!"

End Select

next

Call RestartPocitaca

Set objWMIService = Nothing

Set arrayBoards = Nothing

Set objShell = Nothing

Wscript.Quit(0)

Sub OdoslanieMailu

Dim objEmail, objNetwork

Dim strComputerName

Set objEmail = CreateObject("CDO.Message")

Set objNetwork = CreateObject("Wscript.Network")

strComputerName = objNetwork.ComputerName

With objEmail

.From = strComputerName & "@domain.com"

.To = "USD_Install@domain.com"

.Subject = "Error"

.Textbody = "Unknown chipset for " & strBoard.Product

.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.domain.cz"

.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

.Configuration.Fields.Update

.Send

End With

Set objEmail = Nothing

Set objNetwork = Nothing

End Sub

Function NainstalovanieChipsetu(strTypPocitaca)

'Wscript.Echo strInstallPath & strTypPocitaca & "\setup.exe -b -s"

objShell.Run strInstallPath & strTypPocitaca & "\setup.exe -b -s", 1, True

'wscript.echo ". Nainstalovany chipset pre pocitac " & strTypPocitaca

End Function

Sub RestartPocitaca

objShell.Run "shutdown.exe -r -f -t 01", 0, False

End Sub

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...