Martin Zugec Posted June 24, 2005 Share Posted June 24, 2005 Hello guys!I needed to perform some actions based on detected PnP devices. So for example when wifi is detected, it will automatically install required software etc... Maybe someone will find it useful, so I will post it. PnPBased.vbs:'PnP based actions'Martin Zugec'22.6.2005Set objShell = Wscript.CreateObject("Wscript.shell")Set objWMIService = GetObject("winmgmts:root\cimv2")Set arrayPnP = objWMIService.InstancesOf("Win32_PnPEntity", 48)strInstallPath = Left(WScript.ScriptFullName,Len(Wscript.ScriptFullName) - Len(WScript.ScriptName + "n")) & "\"For Each strPnP in arrayPnP ' Wscript.Echo strPnP.PnPDeviceID Select Case Trim(Lcase(strPnP.PnPDeviceID)) Case Trim(Lcase("pci\ven_8086&dev_4223&subsys_10218086&rev_05\4&39a85202&0&18f0")) 'Instalace wifi od Intelu objShell.Run strInstallPath & "\WiFi\Intel\setup.exe -b -s", 1, True End SelectNextPnPBased.bat (this is for viewing all PnP identifiers + names in system)WMIC path win32_pnpentity get name, PnPDeviceID /format:htable > PnP.htmlstart PnP.html Link to comment Share on other sites More sharing options...
sintaxasn Posted June 25, 2005 Share Posted June 25, 2005 Hey, this is a nice idea - we use something similar for our build, but on a per-machine basis as opposed to a per-device.We use:__WQL = "Win32_ComputerSystemProduct"For Each oItem In GetObject("winmgmts:\\.").InstancesOf(WQL) sVendor = oItem. sMachineName = oItem.Version sMachineModel = oItem.NameNextWQL = Nothing__We then match the machine vendor, name and model to some INI files to determine what should be installed for each machine type.Cheers, Dan Link to comment Share on other sites More sharing options...
Martin Zugec Posted June 27, 2005 Author Share Posted June 27, 2005 I am using this method, also But instead of your method I am using class Win32_ComputerSystem and property Model. For my notebook result is Latitude D600, for desktop it is Optiplex GX280 etc... PnP is for devices, that are independent, so every model can have them attached - like USB modul or similar... Link to comment Share on other sites More sharing options...
MOONLIGHT SONATA Posted July 20, 2005 Share Posted July 20, 2005 @Martin,Here's my questions:1. By saying that "upon detection of multimedia keyboard..", what specific software could be installed. Do you mean only MMKeyboard driver as the software you wish to install? 2. CD-Writer detection based Nero installation is exemplary. I'll surely implement this. Does the code given by you is enough for that to be tried by me? or it needs any modifications ?3. Does the given script is modifiable in such a way so that upon detection of CPU type (Intel or AMD or VIA),applicable driver is installed from there. I'm particularly asking this for Intel, as its INF files contain no direct driver file copy instructions. For them setup.exe route is to be follwed. If it can be achieved from such type of scripts then Intel Driver Installation will be xtremely customizable.4. Suppose i've 2 machines and 2 TV Tuner Cards. Now, how i customize that code in order to install OEM-specific drivers or software by including a single script inside a single UAXPCD having both the driver packages in it ?I'm specifically putting these questions for after your clarification i can learn the logic of implementing such idea better. It then gives me a chance to vary the script as per situation. I ask you to help me everyday because you belong to a minotrity pool of people who, instead of syntax, tries to center all their discussions upon logic. Waiting for your kind response.... Link to comment Share on other sites More sharing options...
Martin Zugec Posted July 21, 2005 Author Share Posted July 21, 2005 1.) I am using Microsoft mouse & keyboard, so I am installing specific SW for them.2.) Yep, it is3.) Hmmm, it should be able to work that way, Go for it and try it!4.) Yes, look at bottom.Ok, here is not one-word answer First you must run PnPBased.bat. The result will be web page, where your pnp devices are listed. The important stuff is on right side - it is PnP identifier associated with device. Next you need to add this identifier to script:Case Trim(Lcase("pci\ven_8086&dev_4223&subsys_10218086&rev_05\4&39a85202&0&18f0"))where pci\ven...f0 is the identifier taken from PnPBased.batAnd under command Case you will just include what you want to do when this PnP identifier is encountered! Really simple I think... Link to comment Share on other sites More sharing options...
MOONLIGHT SONATA Posted August 10, 2005 Share Posted August 10, 2005 @Martin,What i'm going to say now is not PnP-based, instead it is thematically linked to your PnP Method. So, instead of starting a fresh thread i post it here;During setup user can select his choice of FileSystem( or it can be automated, whatever...), either FAT32 or NTFS. Now, if user has some software which are File System specific; for example, NTFSstreamsInfo or R-Studio FAT or R-Studio NTFS versions, can such software installation be done as it's done intelligently in case of PnP-based Programs, so that only NTFS-specific programs get installed if FS is NTFs and vice-versa? I know, your answer is yes. Mine also, but now i put it specifically: how to construct it through a vbscript,..... will i go for checking any Registry Key or i go for any WMI class query? If WMI, then Win32_????????????????Waiting for your kind response.... Link to comment Share on other sites More sharing options...
MOONLIGHT SONATA Posted August 24, 2005 Share Posted August 24, 2005 Dear Martin,Here're a few questions again that bothers me....I know you're very busy, please look into these only when you find time.1.) Is it not possible to alter your script slightly in order and instead of finding pci\ven_ string, it actually finds Product name like VIA/S3G Unichrome IGP. My logic is, if this possible then we can crudely install or run .EXE setup files just because of finding nVidia or ATI or VIA string from product description.2.) If it's possible, can i be able to check the ?-bit OS running, so that if its AMD 64-bit and 64-bit XP OS, i can install VIA Hyperion Pro Pack or if its AMD 32-Bit and OS is 32-bit i can install VIA Hyperion 4-in-1 Driver Pack.3.) Can this VB script be modified in the line of old batch files, so that if its Intel 845, some .exe will run, or if it's Intel 915, some other .exe will run. Similar to our old "If error level n goto m" batch commands.4.) I currently use CD-Writer, wish to buy a DVD-RW in a few weeks time. Now, IDE\CDROMHL-DT-ST_CD-RW_GCE-8320B________________1.04____\5&19E23F39&0&0.0.0 is for my CD-RW. How could i guess what it will be for My DVD-RW , so that i include it in my UAXPCD now, and Nero gets installed upon detecting my DVD-RW?whenever you find sometime, look into these questions, as you looked and suggested all along since i joined this forum. Link to comment Share on other sites More sharing options...
Martin Zugec Posted August 25, 2005 Author Share Posted August 25, 2005 1.) Yes, I could do that... Or you can try if you feel for it 2.) I will add in next version, good idea3.) I didnt understand The Case is working like If %var% Then etc...You can separate different identifiers by comma character4.) Just mount the drive, run analyzer and you will see identificator for that drive. Link to comment Share on other sites More sharing options...
MOONLIGHT SONATA Posted August 25, 2005 Share Posted August 25, 2005 @Martin,1.) As I feel for it, i'll definitely try the Changes on my own. I know, if i can do that, i'll get your pat in the back, which is my ultimate motivation. Yours...@ 4.) What's the Analyzer, and Is there any way to do this before mounting the drive? I want it now, but my DVD-Rw will come later. Case of DVD-RW is actually fictitious, I want to see variations in an already implementable idea. It only expanses my knowledge reach. And you know, I'm the self-proclaimed On-Line Student of you in this regard. My antics are little irritating, but i can't escape... Withstand Me. Please.... Link to comment Share on other sites More sharing options...
Martin Zugec Posted August 26, 2005 Author Share Posted August 26, 2005 1.) Go for it, I`m waiting for result 2.) Analyzer is PnPBased.bat... Only way to do it is to ask manufacturer about PnP identifier of the drive, he should send it to you... Every product have ONE PnP identifier, it is not unique per device Link to comment Share on other sites More sharing options...
RogueSpear Posted August 26, 2005 Share Posted August 26, 2005 Very good work here. A couple of weeks ago I started a VBscript to determine the make of the CPU and mobo chipset in order to install appropriate software. If it's an intel chipset and CPU then install all of the Intel utilities for testing genuine clock freq., hyperthreading, etc. If it's an AMD CPU then install Central Brain Identifier, and so forth.It's almost creepy how similar my code is to yours. It's like we wanted to do exactly the same thing and do it the same way. Just wish I had seen this before because it would have saved me a ton of time Link to comment Share on other sites More sharing options...
MOONLIGHT SONATA Posted August 27, 2005 Share Posted August 27, 2005 @Martin,I'm in serious trouble in writting script. Problem is in Scripting Dependency of Setup.exe upon finding "Description" from Win32_videocontroller. even if i get "VIA/S3G" or Simply "VIA", how could i instruct running of a Setup.eXE just on the basis of finding "VIA". There're so many chipsets; Imagine my plight if i think about Intel--It'll kill Installation if upon finding "INTEL" as output from "Description" if i instruct script to run a particular Setup.EXe. What is Needed is To match "INTEL" or "VIA" with some chipset identification param and then schedule running a matching Setup.EXE. As i'm a n00b in VB Script , it's almost impossible for me to do these string matching without your generous inputs; After all, it's not batch filing method; i miss findstring so much. Please, help.@RogueSpearthanks for your comment on Martin's Script and ongoing discussions. Can you please share your script with us, so that my miseries are solved. I guess what i wrote above to martin is managed by you in your script. waiting kind response from both of you..... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now