Script to determine model
来源:互联网 发布:淘宝王府井百货靠谱么 编辑:程序博客网 时间:2024/06/05 18:21
转自http://www.altirigos.com/vbulletin/deployment-server/6691-script-determine-model.html
Script to determine model
Just a quick to see if anyone has an example of a script to determine the Model of a computer? I just need to push software to various machines and would like to have it determine the Model and then install the appropriate software. I believe I have to go with a field in the DB like %#!computer@prod_name% or somehting like that? Any help would be greatly appreciated?
05-24-2007, 10:52 PM #2 (permalink)
Altiris Architect (Site Founder)
Join Date: 01-01-2005
Location: RDU, North Carolina, USA
Posts: 4,650
I would suggest using conditions to this rather than a script.
__________________Scire potentia est (knowledge is power)
05-24-2007, 11:15 PM #3 (permalink)
Junior Altiris Admin
Join Date: 05-17-2005
Location: Australia
Age: 33
Posts: 19
Conditions
Yeah i looked at conditions but they encompass the whole job? i want to run a script after an HII imaging job to install all those platform specific pieces of software?
05-25-2007, 08:42 AM #4 (permalink)
Altiris Architect (Site Founder)
Join Date: 01-01-2005
Location: RDU, North Carolina, USA
Posts: 4,650
Is your HII just an image or is there some sort of firm injection going on?
__________________Scire potentia est (knowledge is power)
05-27-2007, 07:10 PM #5 (permalink)
Junior Altiris Admin
Join Date: 05-17-2005
Location: Australia
Age: 33
Posts: 19
HII Process
There is a firm injection process going on for Drivers and some other generic software.
05-27-2007, 09:10 PM #6 (permalink)
Altiris Architect (Site Founder)
Join Date: 01-01-2005
Location: RDU, North Carolina, USA
Posts: 4,650
If you use conditions there are a couple of ways to go.
- Create a condition for each model (firm injection) and then include the other steps within each condition... software install etc
- Create a condition for each model (firm injection) then have a success code criteria point to another job that would do the software install.
__________________Scire potentia est (knowledge is power)
05-27-2007, 09:24 PM #7 (permalink)
Junior Altiris Admin
Join Date: 09-24-2006
Location: Australia
Posts: 17
This is how we do it the below as part of our Hii.bat that runs after the imag has been pushed to the client. Hope this helpsecho hardware model is %#!computer@model_num%echo " %#!computer@prod_name%" > a:/model.txtecho Computer model is " %#!computer@prod_name%"type a:/model.txt|find "Latitude D420"if NOT ERRORLEVEL 1 goto D420 type a:/model.txt|find "HP d530"if NOT ERRORLEVEL 1 goto HPD530type a:/model.txt|find "HP Compaq dc7100"if NOT ERRORLEVEL 1 goto HPdc7100if "%#!computer@model_num%" == "085Ch" goto HPD530if "%#!computer@model_num%" == "097Ch" goto HPdc7100
05-28-2007, 07:26 AM #8 (permalink)
Junior Altiris Admin
Join Date: 12-20-2005
Location: Sweden
Age: 33
Posts: 24
I have developed a simple solution to get the computer model in Altiris. The problem today is that some computers does not report a easy-to-use model number. A good example is IBM. Here is what you do;1. Start SQL query analyzer and run the following SQL script;USE eXpressGOCREATE FUNCTION [dbo].[fnGetComputerModelID]( @ComputerID int,@Type int) RETURNS nvarchar(8)ASBEGIN DECLARE @TempString nvarchar(100)DECLARE @ModelID nvarchar(8)DECLARE @ModelNumber nvarchar(100)DECLARE @ProductName nvarchar(100)SET @ModelNumber = (SELECT UPPER(model_num) FROM computer WHERE computer_id = @ComputerID)SET @ProductName = (SELECT UPPER(prod_name) FROM computer WHERE computer_id = @ComputerID)SET @ModelNumber = REPLACE(@ModelNumber, ' ', '')SET @ModelNumber = REPLACE(@ModelNumber, '_', '')SET @ModelNumber = REPLACE(@ModelNumber, '-', '')SET @ModelNumber = REPLACE(@ModelNumber, '(', '')SET @ModelNumber = REPLACE(@ModelNumber, ')', '')SET @ModelNumber = REPLACE(@ModelNumber, '#', '')SET @ProductName = REPLACE(@ProductName, ' ', '')SET @ProductName = REPLACE(@ProductName, '_', '')SET @ProductName = REPLACE(@ProductName, '-', '')SET @ProductName = REPLACE(@ProductName, '(', '')SET @ProductName = REPLACE(@ProductName, ')', '')SET @ProductName = REPLACE(@ProductName, '#', '')-- Set Model ID using Model NumberIF @Type = 1 BEGINSET @ModelID = @ModelNumberEND-- Set Model ID using Product NameIF @Type = 2 BEGINSET @ModelID = @ProductNameEND-- Set Model ID using Model Number and Product NameIF @Type = 3 BEGINSET @ModelID = CAST(@ModelNumber AS nvarchar(4)) + CAST(@ProductName AS nvarchar(4))END-- Set Model ID using special methodIF @Type = 4 BEGINSET @ModelID = SUBSTRING(@ModelNumber, 1, 1) + SUBSTRING(@ProductName, 7, 1) + SUBSTRING(@ModelNumber, 2, 1) + SUBSTRING(@ProductName, 5, 1) + SUBSTRING(@ModelNumber, 3, 1) + SUBSTRING(@ProductName, 3, 1) + SUBSTRING(@ModelNumber, 4, 1) + SUBSTRING(@ProductName, 1, 1)ENDRETURN @ModelIDENDGO2. Create a task in DS that copies drivers;SET MODELID=%#*"SELECT [dbo].[fnGetComputerModelID] (%ID%, X)"%FIRM.EXE -recurse copy F:/DRIVERS/%MODELID%/*.* PROD:/DRIVERSYou have now 4 different method to get the computer model. Just replace X above with 1-4. The SQL function returns max 8 chars which makes it easy to create a folder structure. And you have the option to use model number or product name...Hope it helps!
__________________Robert LundstenAltiris SpecialistAsterio AB, Swedenwww.asterio.se
05-28-2007, 08:36 AM #9 (permalink)
Altiris Architect (Site Founder)
Join Date: 01-01-2005
Location: RDU, North Carolina, USA
Posts: 4,650
Nice bit of code Robert.
__________________Scire potentia est (knowledge is power)
- Script to determine model
- High SQL Version Counts - Script to determine reason(s)
- High SQL Version Counts - Script to determine reason(s) (文档 ID 438755.1)
- Exception in thread "main" org.javalite.activejdbc.InitException: failed to determine Model class na
- vnc model startup script
- mwactl: Unable to determine MWA_TOP.
- How To Determine Granule Size
- To Determine a Prime Number
- failed to determine path to aas directory
- caffe model to darknet model
- How to determine if running on Emulator?
- Unable to determine default Pin/Port configuration!
- Ping to Determine MTU along a route
- Unable to determine name from existing gemspec
- Easy way to determine virtualization technology
- pi4j 出错: Unable to determine hardware version
- Script to shrink tempfiles
- Transaction Script 、 Doamin Model、Logic SQL
- 开发者版本:你属于哪个版本的程序员?
- Deployment Server / Active Directory Synchronization
- JAVA程序员之路
- [客运中国]上线了
- 快进新房了
- Script to determine model
- 华为:做一家快乐公司
- 任正非:我的父亲母亲
- 任正非 天道酬勤
- 致新员工书
- 软件路由器
- Linux操作系统中GCC的应用介绍一
- ext的grid里面如何删除行?
- 第一次登陆CSDN