Jump to content

Install Unknown Devices


Bilou_Gateux

Recommended Posts

Here a small batch i use to install the devices unknown from Windows at the end of install.

May be someone will find it of some interest...

Required tools:

@ECHO OFF
SETLOCAL
set DriverPack=%SystemDrive%\PnPDrvrs
::// Define which class to install/update
set class=Unknown
::// Path to Pyron's SetupCopyOEMInf.exe tool
set SetupCopyOEMInf=.\bin\CopyINFs.exe
::// Path to Device Console tool
set DevCon=.\bin\devcon.exe

%SetupCopyOEMInf% %DriverPack%
::// goto :%class%

:Unknown
set command=remove
::// Find all Devices, with specified setup %class% name, and start %command% subroutine for each one
FOR /F "tokens=1* delims=: " %%A IN ('%DevCon% FindAll ^=%class% ^| FIND ":"') DO (SET ID="%%A")&(SET DEVICE=%%B)&(SET HWID=%ID:~0,22%")&(CALL :%command%)
::// run single %command%
set command=rescan
goto :%command%

:remove
::// Remove devices that match the specific hardware or instance ID
echo Device: %device%
%DevCon% %command% %HWID%

:rescan
::// Tell plug&play to scan for new hardware
%DevCon% %command%

to help understanding the batch script, see output for a Video Controller:

command:

DEVCON FindAll =Unknown | FIND ":"
output: %%a : %%b
PCI\VEN_8086&DEV_2572&SUBSYS_101B1734&REV_02\3&61AAA01&0&10 : Video Controller

set variables:

HWID="PCI\VEN_8086&DEV_2572"

DEVICE=Video Controller

Remove device that match the specific hardware or instance ID:

devcon remove "PCI\VEN_8086&DEV_2572"
Tell plug&play to scan for new hardware:
devcon rescan

I don't install unknown devices during UA install using methods described in this forum for one reason. I use the same Hard Drive with the installed Windows in two box with different hardware. Solution 7: Create a new Hardware Profile before shutdown Windows.

Question: does anybody know how to create a new Hardware Profile with a command line?

standard GUI method:How To Create Hardware Profiles on Windows-Based Mobile Computers

Edited by Bilou_Gateux
Link to comment
Share on other sites

  • 2 weeks later...

Script used to update display driver configured with default OS drivers.

; T2100222.inf

;

; Installation inf for the Trident series of graphics adapters.

; © Copyright 2003, Trident Microsystems, Inc. All rights reserved.

;

[Version]Signature="$WINDOWS NT$"

Provider=%trident%

ClassGUID={4D36E968-E325-11CE-BFC1-08002BE10318}

Class=Display

CatalogFile=tridxp4.cat

DriverVer=06/03/2003,6.14.01.0006

../..

[trident.Mfg]

Trident Video Accelerator Cyber-XP4  v6.4823-104.22_2   = tridxp4, PCI\VEN_1023&DEV_2100&SUBSYS_00021179

path=%DriverPack%\%Class%\%infdir%\%infname%

C:\PnPDrvrs\Display\T2100222\T2100222.inf
Drivers are compressed using hp38guser Driver Compressor tool.

soul DriverInstall.exe tool is used for non digitally signed drivers.

command:

DEVCON FindAll =Display | findstr /R /I "\\V"

output: BUS VEN DEV SUBSYS DEVICE

PCI\VEN_1023&DEV_2100&SUBSYS_00021179&REV_91\4&1BFA44D4&0&0008: Standard VGA Graphics Adapter
@ECHO OFF

:: Check Windows version
IF "%OS%"=="Windows_NT" (SETLOCAL) ELSE (GOTO Syntax)
VER | FIND "Windows NT" >NUL && GOTO Syntax

:: Check command line arguments
IF NOT "%~1"=="" IF /I NOT "%~1"=="/A" GOTO Syntax

set DriverPack=C:\PnPDrvrs
:: Choose between all devices or just the Display class
IF /I "%~1"=="/A" (SET class=Unknown) ELSE (SET class=Display)

:step1
echo.%class%
call :FindDev
echo.%DEVICE%
echo.%HWID%
CALL :HWID %DriverPack%\%Class%
echo.%INF%
CALL :Exec updateni %INF% %HWID%

:: Done
ENDLOCAL
GOTO End

:FindDev
FOR /F "tokens=1-3* delims=\: " %%a in ('devcon findall ^=%class% ^| findstr /R /I "\\V"') do (set device="%%d")&(
for /f "tokens=*" %%e in ("%%b") do (
for /f "tokens=1-4* delims=&" %%f in ("%%e") do (
 set HWID="%%a\%%f&%%g&%%h"
)
)
)
GOTO:EOF

:: :: :: :: ::  HWID  :: :: :: :: ::
:HWID
PUSHD %1
for %%f in (*.inf) do (
for /f "eol=- tokens=2 delims=," %%i in ('find /i "pci\ven" %%f') do (
for /f "tokens=*" %%j in ("%%i") do (
for /f "tokens=1* delims=_" %%k in ("%%j") do (
  if /i "%%k" EQU "PCI\VEN" (
    for /f "usebackq tokens=1* delims=; " %%a in ('%%j') do (
      if /i "%%a" EQU %HWID% set INF=%cd%\%%f
    )
  )
)
)
)
)

FOR /F %%I IN ('DIR /AD /OGN /B') DO (
CALL :HWID %CD%\%%I
)
POPD
GOTO:EOF

:: :: :: :: ::  UPDATENI  :: :: :: :: ::
:Exec
::// digitally signed drivers
echo.devcon %1 %2 %3
::// not digitally signed drivers
driverinstall %1 %2 %3
GOTO:EOF

:Syntax
ECHO.
ECHO Display.cmd Beta release
ECHO Install Display class device drivers, optionally including even unknown ones
ECHO.
ECHO Usage:  UNKNOWN  [ /A ]
ECHO.
ECHO Where:  /A  installs  both Display and Unknown class devices
ECHO             (default is Display class device only)
ECHO.
ECHO Notes:  [1] This batch file requires Microsoft's DEVCON.EXE, available at
ECHO             http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q311272
ECHO.
ECHO Written by Bilou Gateux
ECHO function HWID written by IcemanND
ECHO "http://www.msfn.org/board/index.php?showtopic=43413&view=findpost&p=301583"
ECHO parts of code by Rob van der Woude
ECHO http://www.robvanderwoude.com


:End
IF "%OS%"=="Windows_NT" ENDLOCAL

Batch script will fail if SUBSYS is not defined in device driver inf file. :(

;

; NVIDIA Windows 2000/XP Display INF file

; Copyright 1999-2002 NVIDIA Corporation.  All Rights Reserved.

;

[Version]

Signature="$Windows NT$"

Provider=%NVidia%

ClassGUID={4D36E968-E325-11CE-BFC1-08002BE10318}

Class=Display

CatalogFile=NVFS.CAT

DriverVer = 10/25/2002, 4.1.0.4

../..

[NVidia.Mfg]

%NVidia.Nv17.1% = nv4_novpe, PCI\VEN_10DE&DEV_0170

%NVidia.Nv17.2% = nv4_novpe, PCI\VEN_10DE&DEV_0171

%NVidia.Nv17.3% = nv4_novpe, PCI\VEN_10DE&DEV_0172

%NVidia.Nv17GL.1% = nv4_WSApps_novpe, PCI\VEN_10DE&DEV_0178

%NVidia.Nv17GL.2% = nv4_WSApps_novpe, PCI\VEN_10DE&DEV_017A

to avoid this issue set HWID="%%a\%%f&%%g" in :FindDev

Edited by Bilou_Gateux
Link to comment
Share on other sites

  • 4 weeks later...

Hi Bilou,

I got a vbscript to identify which device is not installed properly in windows 2003 server but am not able to get an option to uninstall the same using vbscript.

Tried calling ur batch file in my script but it dint work. Do you have any idea on vbscript if it has some option to uninstall the device from device manager.

Pls let me know if u have any clue. Thanks!!

Vidhya P

Link to comment
Share on other sites

  • 2 years later...

Woah!

Does this still work or is there now another solution?

I was thinking about creating a Universal Driver Disk based of BTS current DP's (a script that would extract the driver packs and use his finisher to integrate the INF/PNF's into the windows directory). I just don't know how to write a script that would detect all hardware that doesn't have proper drivers installed and then remove them and then @ the end, redetect PNP Hardware...

Thoughts appreciated!

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...