转自http://www.altirigos.com/vbulletin/deployment-server/6691-script-determine-model.html
![]() | #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)
|
![]() |
![]() |
![]() | #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?
|
![]() |
![]() |
![]() | #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)
|
![]() |
![]() |
![]() | #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.
|
![]() |
![]() |
![]() | #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.
__________________
Scire potentia est (knowledge is power)
|
![]() |
![]() |
![]() | #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 helps echo hardware model is %#!computer@model_num% echo " %#!computer@prod_name%" > a:/model.txt echo 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 HPD530 type a:/model.txt|find "HP Compaq dc7100" if NOT ERRORLEVEL 1 goto HPdc7100 if "%#!computer@model_num%" == "085Ch" goto HPD530 if "%#!computer@model_num%" == "097Ch" goto HPdc7100
|
![]() |
![]() |
![]() | #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 eXpress GO CREATE FUNCTION [dbo].[fnGetComputerModelID] ( @ComputerID int, @Type int ) RETURNS nvarchar(8) AS BEGIN 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 Number IF @Type = 1 BEGIN SET @ModelID = @ModelNumber END -- Set Model ID using Product Name IF @Type = 2 BEGIN SET @ModelID = @ProductName END -- Set Model ID using Model Number and Product Name IF @Type = 3 BEGIN SET @ModelID = CAST(@ModelNumber AS nvarchar(4)) + CAST(@ProductName AS nvarchar(4)) END -- Set Model ID using special method IF @Type = 4 BEGIN SET @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) END RETURN @ModelID END GO
2. Create a task in DS that copies drivers; SET MODELID=%#*"SELECT [dbo].[fnGetComputerModelID] (%ID%,
X)"% FIRM.EXE -recurse copy F:/DRIVERS/%MODELID%/*.* PROD:/DRIVERS You 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 Lundsten
Altiris Specialist
Asterio AB, Sweden
www.asterio.se
|
![]() |
![]() |