Inject PNP Drivers in Windows 7 post deployment

 If you need a process to find and install drivers post process (after Windows or later as an update)

  1. Populate this key with a path to your drivers
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\UnattendSettings\PnPUnattend\DriverPaths\1
    Path = “d:\Drivers”
    <- String
  2. From a script, batch, MDT, setupcomplete.cmd, whatever, Run pnpunattend.exe
    (built into Windows 7 and also there for Vista )

Example: Pnpunattend.exe auditsystem

You can use /s to just search the drivers but not install.  Also, use the /L to output to command so you can pipe into a file if needed.


   PnPUnattend.exe [auditSystem | /help /? /h] [/s] [/L]

       auditSystem   Online driver install.

       /help /? /h    This help.

       /s             Search without installing.

       /L             Print Logging information to the command line.

VBScript: List MS hotfixes installed

Script below will echo out hotfixes installed on current system.  Change strComputer name to display for remote system.
Usage: cscript.exe script.vbs

==Code start==

strComputer = “.”

Set objWMIService = GetObject(“winmgmts:” _

& “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)

Set colQuickFixes = objWMIService.ExecQuery _

(“Select * from Win32_QuickFixEngineering”)

For Each objQuickFix in colQuickFixes

‘ Wscript.Echo “Computer: ” & objQuickFix.CSName

Wscript.Echo “Description: ” & objQuickFix.Description

if objQuickFix.HotFixID<>”File 1″ then Wscript.Echo objQuickFix.HotFixID

wscript.Echo “Installation Date: ” & objQuickFix.InstallDate

Wscript.Echo “Installed By: ” & objQuickFix.InstalledBy


==Code End==

VBScript – Get OS Name

The script below is simple – use it to get the name of the current OS (Windows XP, 7, etc).  Currently it outputs to a message box but can be used for case statements, if else, etc.

Code start

on error r
esume next

sRes = Inputbox(“Enter the Server or Computer name”, “OS”)
strComputer = sRes
if strComputer = “” then
Msgbox “No server was enter, will use current computer”,vbCritical,”Warning”
strComputer = “.”
end if
Set objWMIService = GetObject(“winmgmts:\\”  & strComputer & “\root\cimv2”)
Set colItems = objWMIService.ExecQuery(“Select * from Win32_OperatingSystem”,,48)
For Each objItem in colItems
Msgbox objItem.Caption,VbInformation,”Running on ” & strComputer & ” is:”
Code End