/build/static/layout/Breadcrumb_cap_w.png

K2000 3.4 driver_postinstall folder

Contained within the share \\{k2000 hostname}\drivers_postinstall\feed_tools there is a script (Get_Manufacturer_Model_OS.vbs) to detect the make, model and OS of your computer. It was a great idea that seems to only be half of what we need. I have rewritten the script to ACTUALLY create the folders in question. Now if someone can tell me how to properly populate drivers in these folders I would be grateful.

Thanks

'------------------------------------------------------------------------------------------------------------
'
' rewrite of Get_Manufacturer_Model_OS.vbs
'
'------------------------------------------------------------------------------------------------------------

'Get Manufacturer

wmiQuery = "Select * from win32_ComputerSystem"

Set objWMIService = GetObject("winmgmts:\\")
Set colItems = objWMIService.ExecQuery(wmiQuery)

'-------------------------------------------------------------------------------------------
'
' Script Object Calls:
' objFSO for file system calls
' objShell for environment variable lookup
'
'-------------------------------------------------------------------------------------------
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = WScript.CreateObject("WScript.Shell")

'-------------------------------------------------------------------------------------------
'
' K2000 Hostname
' Verify and store Hostname in variable strHost
'
'-------------------------------------------------------------------------------------------
strHost = Left(WScript.ScriptFullName,(InStr(3,wscript.ScriptFullName,"\")-1))
'-------------------------------------------------------------------------------------------
'
' OS Architecture
' Due to the fact that WMI win32_ComputerSystem.OSArchitecture does not exist in XP or Win2000
' I Use environment variable %Processor_Architecture%
'
'-------------------------------------------------------------------------------------------
strArch = objShell.ExpandEnvironmentStrings("%Processor_Architecture%")


For Each objItem in ColItems
strManufacturer = objItem.Manufacturer
If (InStr(strManufacturer ,"Dell") > 0) Then strManufacturer ="dell"
If (InStr(strManufacturer ,"Hewlett-Packard") > 0) Then strManufacturer ="hp"
If (InStr(strManufacturer ,"Lenovo") > 0) Then strManufacturer ="lenovo"
If (InStr(strManufacturer ,"VMware") > 0) Then strManufacturer ="vmware"
Next
strManufacturer = Replace(strManufacturer, " ", "_")

'*************** Get model
wmiQuery = "Select * from win32_ComputerSystem"

Set objWMIService = GetObject("winmgmts:\\")
Set colItems = objWMIService.ExecQuery(wmiQuery)

For Each objItem in ColItems
strModel = objItem.Model
If (InStr(strModel,"Latitude") > 0) Then strModel = mid(strModel,9,20)
If (InStr(strModel,"Precision") > 0) Then strModel = mid(strModel,10,21)
If (InStr(strModel,"OptiPlex") > 0) Then strModel = mid(strModel,9,20)
strModel = Trim(strModel)
Next
strModel = Replace(strModel, " ", "_")

'*******************Get operating system
wmiQuery = "Select * from Win32_OperatingSystem"

Set objWMIService = GetObject("winmgmts:\\")
Set colOs = objWMIService.ExecQuery(wmiQuery)

For Each objItem in colOs
strOs = objItem.Caption
Next

strModel = Trim(strModel)
'strManufacturer = Trim(strManunacturer)
'strOS = Trim(srtOS)

Wscript.echo("Manufacturer: " & strManufacturer & (Chr(13) & chr(10)) & (Chr(13) & chr(10)) & "Model: " & strModel & (Chr(13) & chr(10)) & (Chr(13) & chr(10)) &"OS: " & strOs & (Chr(13) & chr(10)) & (Chr(13) & chr(10)) & "Architecture: " & strArch)

'-------------------------------------------------------------------------------------------
'
' OS Architecture
' Verify that OS Architecture has a valid answer if not quit script
'
'-------------------------------------------------------------------------------------------
If strArch = "AMD64" Then
ElseIf strArch = "x86" Then
Else
Wscript.echo "Script could not determine Architecture please create driver folders manually."
Wscript.quit
End If

'-------------------------------------------------------------------------------------------
'
' Manufacturer
' Verify and create Manufacturer if it does not exist
'
'-------------------------------------------------------------------------------------------
If objFSO.FolderExists(strHost & "\drivers_postinstall" & "\" & strManufacturer) = False Then
objFSO.CreateFolder(strHost & "\drivers_postinstall" & "\" & strManufacturer)
End If

'-------------------------------------------------------------------------------------------
'
' OS & Architecture
' Verify and create OS folder based on Caption and Architecture if it does not exist
'
'-------------------------------------------------------------------------------------------
If InStr(1,strOS,"7") <> 0 then
If strArch = "AMD64" then
If objFSO.FolderExists(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_7_x64") = False Then
objFSO.CreateFolder(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_7_x64")
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_7_x64"
Else
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_7_x64"
End If
Else
If objFSO.FolderExists(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_7_x32") = False Then
objFSO.CreateFolder(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_7_x32")
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_7_x32"
Else
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_7_x32"
End If
End If
End If

If InStr(1,strOS,"Vista") <> 0 then
If strArch = "AMD64" then
If objFSO.FolderExists(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_vista_x64") = False Then
objFSO.CreateFolder(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_vista_x64")
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_vista_x64"
Else
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_vista_x64"
End If
Else
If objFSO.FolderExists(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_vista") = False Then
objFSO.CreateFolder(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_vista")
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_vista"
Else
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_vista"
End If
End If
End If

If InStr(1,strOS,"XP") <> 0 then
If strArch = "AMD64" then
If objFSO.FolderExists(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_xp_x64") = False Then
objFSO.CreateFolder(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_xp_x64")
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_xp_x64"
Else
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_xp_x64"
End If
Else
If objFSO.FolderExists(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_xp") = False Then
objFSO.CreateFolder(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_xp")
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_xp"
Else
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_xp"
End If
End If
End If

'-------------------------------------------------------------------------------------------
'
'
' Model
' Verify and create Model if it does not exist
'
'
'-------------------------------------------------------------------------------------------

if objFSO.FolderExists(strDriverPath & "\" & strModel) = False then
objFSO.CreateFolder(strDriverPath & "\" & strModel)
End if

wscript.echo strDriverPath & "\" & strModel & " folder has been created."

'-------------------------------------------------------------------------------------------
'
'
' End of Script
'
'
'-------------------------------------------------------------------------------------------

0 Comments   [ + ] Show comments

Answers (1)

Posted by: d_firlotte 12 years ago
Orange Belt
1
Sorry I made a change to the script to handle detecting of x86 and x64 systems with handling of not be able to detect architecture type.

'-------------------------------------------------------------------------------------------
'
' Script supports Windows 7, Windows Vista and Windows XP on 32bit and 64bit
'
'-------------------------------------------------------------------------------------------


'Get Manufacturer

wmiQuery = "Select * from win32_ComputerSystem"

Set objWMIService = GetObject("winmgmts:\\")
Set colItems = objWMIService.ExecQuery(wmiQuery)

'-------------------------------------------------------------------------------------------
'
' Script Object Calls:
' objFSO for file system calls
' objShell for environment variable lookup
'
'-------------------------------------------------------------------------------------------
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = WScript.CreateObject("WScript.Shell")

'-------------------------------------------------------------------------------------------
'
' K2000 Hostname
' Verify and store Hostname in variable strHost
'
'-------------------------------------------------------------------------------------------
strHost = Left(WScript.ScriptFullName,(InStr(3,wscript.ScriptFullName,"\")-1))
'-------------------------------------------------------------------------------------------
'
' OS Architecture
' Due to the fact that WMI win32_ComputerSystem.OSArchitecture does not exist in XP or Win2000
' I Use environment variable %Processor_Architecture%
'
'-------------------------------------------------------------------------------------------
strArch = objShell.ExpandEnvironmentStrings("%Processor_Architecture%")


For Each objItem in ColItems
strManufacturer = objItem.Manufacturer
If (InStr(strManufacturer ,"Dell") > 0) Then strManufacturer ="dell"
If (InStr(strManufacturer ,"Hewlett-Packard") > 0) Then strManufacturer ="hp"
If (InStr(strManufacturer ,"Lenovo") > 0) Then strManufacturer ="lenovo"
If (InStr(strManufacturer ,"VMware") > 0) Then strManufacturer ="vmware"
Next
strManufacturer = Replace(strManufacturer, " ", "_")

'*************** Get model
wmiQuery = "Select * from win32_ComputerSystem"

Set objWMIService = GetObject("winmgmts:\\")
Set colItems = objWMIService.ExecQuery(wmiQuery)

For Each objItem in ColItems
strModel = objItem.Model
If (InStr(strModel,"Latitude") > 0) Then strModel = mid(strModel,9,20)
If (InStr(strModel,"Precision") > 0) Then strModel = mid(strModel,10,21)
If (InStr(strModel,"OptiPlex") > 0) Then strModel = mid(strModel,9,20)
strModel = Trim(strModel)
Next
strModel = Replace(strModel, " ", "_")

'*******************Get operating system
wmiQuery = "Select * from Win32_OperatingSystem"

Set objWMIService = GetObject("winmgmts:\\")
Set colOs = objWMIService.ExecQuery(wmiQuery)

For Each objItem in colOs
strOs = objItem.Caption
Next

strModel = Trim(strModel)
'strManufacturer = Trim(strManunacturer)
'strOS = Trim(srtOS)

'-------------------------------------------------------------------------------------------
'
' OS Architecture
' Verify that OS Architecture has a valid answer if not quit script
'
'-------------------------------------------------------------------------------------------
If strArch = "AMD64" Then
Wscript.echo("Manufacturer: " & strManufacturer & (Chr(13) & chr(10)) & (Chr(13) & chr(10)) & "Model: " & strModel & (Chr(13) & chr(10)) & (Chr(13) & chr(10)) &"OS: " & strOs & (Chr(13) & chr(10)) & (Chr(13) & chr(10)) & "Architecture: " & strArch)
ElseIf strArch = "x86" Then
Wscript.echo("Manufacturer: " & strManufacturer & (Chr(13) & chr(10)) & (Chr(13) & chr(10)) & "Model: " & strModel & (Chr(13) & chr(10)) & (Chr(13) & chr(10)) &"OS: " & strOs & (Chr(13) & chr(10)) & (Chr(13) & chr(10)) & "Architecture: " & strArch)
Else
Wscript.echo("Manufacturer: " & strManufacturer & (Chr(13) & chr(10)) & (Chr(13) & chr(10)) & "Model: " & strModel & (Chr(13) & chr(10)) & (Chr(13) & chr(10)) &"OS: " & strOs & (Chr(13) & chr(10)) & (Chr(13) & chr(10)) & "Architecture: " & strArch & (Chr(13) & chr(10)) & (Chr(13) & chr(10)) & "Script could not determine Architecture please create driver folders manually.")
Wscript.quit
End If

'-------------------------------------------------------------------------------------------
'
' Manufacturer
' Verify and create Manufacturer if it does not exist
'
'-------------------------------------------------------------------------------------------
If objFSO.FolderExists(strHost & "\drivers_postinstall" & "\" & strManufacturer) = False Then
objFSO.CreateFolder(strHost & "\drivers_postinstall" & "\" & strManufacturer)
End If

'-------------------------------------------------------------------------------------------
'
' OS & Architecture
' Verify and create OS folder based on Caption and Architecture if it does not exist
'
'-------------------------------------------------------------------------------------------
If InStr(1,strOS,"7") <> 0 then
If strArch = "AMD64" then
If objFSO.FolderExists(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_7_x64") = False Then
objFSO.CreateFolder(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_7_x64")
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_7_x64"
Else
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_7_x64"
End If
Else
If objFSO.FolderExists(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_7_x32") = False Then
objFSO.CreateFolder(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_7_x32")
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_7_x32"
Else
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_7_x32"
End If
End If
End If

If InStr(1,strOS,"Vista") <> 0 then
If strArch = "AMD64" then
If objFSO.FolderExists(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_vista_x64") = False Then
objFSO.CreateFolder(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_vista_x64")
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_vista_x64"
Else
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_vista_x64"
End If
Else
If objFSO.FolderExists(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_vista") = False Then
objFSO.CreateFolder(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_vista")
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_vista"
Else
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_vista"
End If
End If
End If

If InStr(1,strOS,"XP") <> 0 then
If strArch = "AMD64" then
If objFSO.FolderExists(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_xp_x64") = False Then
objFSO.CreateFolder(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_xp_x64")
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_xp_x64"
Else
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_xp_x64"
End If
Else
If objFSO.FolderExists(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_xp") = False Then
objFSO.CreateFolder(strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_xp")
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_xp"
Else
strDriverPath = strHost & "\drivers_postinstall" & "\" & strManufacturer & "\windows_xp"
End If
End If
End If

'-------------------------------------------------------------------------------------------
'
'
' Model
' Verify and create Model if it does not exist
'
'
'-------------------------------------------------------------------------------------------

if objFSO.FolderExists(strDriverPath & "\" & strModel) = False then
objFSO.CreateFolder(strDriverPath & "\" & strModel)
End if

wscript.echo strDriverPath & "\" & strModel & " folder has been created."
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
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