/build/static/layout/Breadcrumb_cap_w.png

Help on Audio Drivers wise script

Hi Folks,

  I need help on wise script. The main purpose of the script is to find out the device model number and then install audio drivers accordingly .
Per example: 
  If  Model number = HP Folios 9480m 
                       then 
                         Execute " audiodriver 1 setup.exe" -s -f1"setup1.iss" 
                       else if model number = HP Folios 9470m
                         then 
                           Execute "audiodriver2 setup.exe" -s -f1"setup1.iss"
                        End
                  End

I dont know how to get the device information. Please help me on this script.

Fyi:
I am using Wise package studio 8.0 to package the application.I have 2 audio drivers for two different laptop models

Thanks,
Sri.

0 Comments   [ + ] Show comments

Answers (3)

Answer Summary:
Posted by: EdT 9 years ago
Red Belt
0
Wisescript does not lend itself to retrieving model information unless you have previously anticipated such a requirement and have coded the model information as a registry value as part of the operating system build process.
Typically, you can get the detailed model information using WMI, and you can call the WMI code from wisescript and have it write the information to a temporary file which the subsequent Wisescript code can then read and call other programs appropriately.
Let me know if you can't figure this out.

Comments:
  • I am trying to use WMI to determine if a package can be run on a computer. I'm not sure how to start with this. I know that i will need the WMI to set a variable and from that i can have wisescript run or not run.

    This is the WMI that i have started.

    strComputer = "."

    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

    Set colComputerSystem = objWMIService.ExecQuery ("Select * from Win32_computersystem")

    Set colBIOS = objWMIService.ExecQuery ("Select * from Win32_BIOS")

    For each objComputerSystem in colComputerSystem

    GetComputerManufacturer = objComputerSystem.Manufacturer

    GetComputerModel = objComputerSystem.Model

    Next

    Wscript.echo "The system you are on is a " & GetComputerManufacturer & " " & GetComputerModel

    how would i get this to output to a variable? - srisidhu558 9 years ago
    • The simplest way is to write the information to a file or registry key and read using Wisescript. However, depending on what you want to do overall, writing the whole code in vbscript would be a lot easier. I'll try to find some code for you as I think there is another method that may help you. - EdT 9 years ago
      • Thanks so much your valuable time EdT. I have tried couple of way(i.e created bat file and executed through wise script, create variables, functions and all ... ) to import above code, but no evil. I will be waiting for your code. - srisidhu558 9 years ago
Posted by: EdT 9 years ago
Red Belt
0

Top Answer

OK, here is a script I wrote a few years ago to detect a range of Lenovo machines.  There is probably more information being gathered than you need for your specific requirement so you can cut out anything you don't need. This code ended up part of a build process and determined the right drivers to install for each model - not just audio drivers.
Hope this helps.

' Set Environment

ver="CHASSIS 6 September 2009"
subtype=""
mdl="-(SUPPORTED)"
desc="UNSUPPORTED"
Const ForReading = 1, ForWriting = 2
Dim fso, f, yesno
Set fso = CreateObject("Scripting.FileSystemObject")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

' Identify Machine Type and then partition accordingly
Set colEnclosures = objWMIService.ExecQuery("Select * from Win32_SystemEnclosure") 

   For Each objEnclosure in colEnclosures
      For Each intChassisType in objEnclosure.ChassisTypes

Select Case intchassistype
 Case "1" : strchassistype = "(1)Other"
 Case "2" : strchassistype = "(2)Unknown"
 Case "3" : strchassistype = "(3)Desktop"
 Case "4" : strchassistype = "(4)Low Profile Desktop"
 Case "5" : strchassistype = "(5)Pizza Box"
 Case "6" : strchassistype = "(6)Mini Tower"
 Case "7" : strchassistype = "(7)Tower"
 Case "8" : strchassistype = "(8)Portable"
 Case "9" : strchassistype = "(9)Laptop"
 Case "10" : strchassistype = "(10)Notebook"
 Case "11" : strchassistype = "(11)Hand Held"
 Case "12" : strchassistype = "(12)Docking Station"
 Case "13" : strchassistype = "(13)All in One"
 Case "14" : strchassistype = "(14)Sub Notebook"
 Case "15" : strchassistype = "(15)Space-Saving"
 Case "16" : strchassistype = "(16)Lunch Box"
 Case "17" : strchassistype = "(17)Main System Chassis"
 Case "18" : strchassistype = "(18)Expansion Chassis"
 Case "19" : strchassistype = "(19)SubChassis"
 Case "20" : strchassistype = "(20)Bus Expansion Chassis"
 Case "21" : strchassistype = "(21)Peripheral Chassis"
 Case "22" : strchassistype = "(22)Storage Chassis"
 Case "23" : strchassistype = "(23)Rack Mount Chassis"
 Case "24" : strchassistype = "(24)Sealed-Case PC"
 Case else : strchassistype = "(Undefined)"
End Select

'Find the model

 Set colComputerSystems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
 For Each objComputerSystem in colComputerSystems
   strManufacturer = objComputerSystem.Manufacturer
   strModelA = objComputerSystem.Model
 Next

 strModel = Left(strModelA,4)  'Extract first four digits of model number

Select Case strModel

  Case "8171":desc="S51 Desktop"
  Case "8143":desc="M51 Desktop"
  Case "6223":desc="Zpro Desktop"
  Case "9228":desc="ZPro Desktop"
  Case "8811":desc="M55 Tower"
  Case "8808":desc="M55 SFF"
  Case "6072":desc="M57 SFF"
  Case "6075":desc="M57 Tower"
  Case "6234":desc="M58p SFF"
  Case "6209":desc="M58p Tower"
  Case "2672":desc="X32 Laptop no Fingerprint sensor"
  Case "2668":desc="T43 Laptop with Fingerprint sensor"
  Case "2008":desc="T60P Laptop with Fingerprint sensor"
  Case "1707":desc="X60 Laptop with Fingerprint sensor"
  Case "7674":desc="X61 Laptop with Fingerprint sensor"
  Case "6457":desc="T61P Laptop with Fingerprint sensor"
  Case "7459":desc="X200 Laptop with Fingerprint sensor"
  Case "2055":desc="T500 Laptop with Fingerprint sensor"
  Case "2056":desc="T500 Laptop with Fingerprint sensor"
  Case "1866":desc="X41T Tablet with Fingerprint sensor"
  Case "7763":desc="X61T Tablet with Fingerprint sensor"
  Case "CF-U":desc="CF-U1 Ruggedised Portable"
  Case "HP x":desc="HP xw8600 Workstation"
  Case "HP Z":desc="HP Z800 Workstation"
  Case "VMwa":desc="VMware Virtual Platform"

End Select


   Next
      Next

'Get the serial number
Set colSMBIOS = objWMIService.ExecQuery ("Select SerialNumber from Win32_SystemEnclosure")
For Each objSMBIOS in colSMBIOS
strSerial=objSMBIOS.SerialNumber
'Wscript.Echo "Serial Number: " & objSMBIOS.SerialNumber
Next

'Display the result
'msgbox "Manufacturer = " & strManufacturer & chr(13) & chr(10) &"Model = " & strModelA & chr(13) & chr(10) &"Description = "&desc& chr(13) & chr(10) & "WMI Type = "&strChassisType & chr(13)& chr(10) & "Serial Number = " & strSerial,4160,ver
msgbox "Manufacturer = " & strManufacturer & chr(13) & chr(10) &"Model = " & strModelA & chr(13) & chr(10) & "WMI Type = "&strChassisType & chr(13)& chr(10) & "Serial Number = " & strSerial,4160,ver

yesno = msgbox ("Do you want to save this information to a file",4100,ver)

if yesno = 6 then 
Set f = fso.OpenTextFile(strManufacturer&"+"&strModelA&".txt", ForWriting, True)
f.writeline "Manufacturer = " & strManufacturer
f.writeline "Model = " & strModelA
' f.writeline "Description = "&desc
f.writeline "WMI Type = "&strChassisType
f.writeline "Asset Tag = " & strSerial
f.close
msgbox "Information written to "&strManufacturer&"+"&strModelA&".txt",4160,ver
end if


Posted by: EdT 9 years ago
Red Belt
0
As you can see, there is no wisescript in the code above, but there is an option to save to a file. You could change the code to save to a fixed filename in a fixed location and then parse the file with wisescript if the need to use wisescript is unavoidable for some reason.

Comments:
  • I have simplified your code as per my requirement. Here is my vbscript below.


    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

    Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystemProduct")

    For each objitem in colItems
    wscript.echo objitem.Name
    Next

    I could able to run this script and got result as model number. but I couldn't able to get the output to redirect to wise script.Can you please me this ? - srisidhu558 9 years ago
    • Can I recommend you read through my past postings here as the answer is already there. - EdT 9 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ