Create a script to install application

Hello all,

we have 3 different hardware models running windows 7. we want to deploy a application based on the model. How can I create a batch file o any other script to run "wmic computersystem get model" based on the model go to model folder and install that application.
For example,
hardware models
HP EliteBook 840 G3
HP EliteBook 840 G4
HP EliteBook 850 G4

There is folder on server share having folder matching same name.

if script detects "HP EliteBook 840 G3", it should check that folder and match the folder name and install the application insid it.

Is there any way to do that?

Regards
shyam pothiniAsked:
Who is Participating?
 
Darrell PorterConnect With a Mentor Enterprise Business Process ArchitectCommented:
To provide a more complete answer...

@for /f "tokens=*" %%m in ('wmic computersystem get model /value ^| find "="') do set %%m
@echo %Model%

If "%Model%" == "HP EliteBook 840 G3" then Goto 840G3
If "%Model%" == "HP EliteBook 840 G4" then Goto 840G4
If "%Model%" == "HP EliteBook 850 G4" then Goto 850G4
Goto WrongModel

:840G3
Start /wait "Installer for 840G3.EXE"

Goto END

:840G4
Start /wait "Installer for 840G4.EXE" /Some_Parameter

Goto END

:850G4
Start /wait "Installer for 8%0G4.EXE"

Goto END

:END

Open in new window

0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Why not do this with a GPO and WMI filtering?
1
 
Darrell PorterEnterprise Business Process ArchitectCommented:
Batch file:
@for /f "tokens=*" %%m in ('wmic computersystem get model /value ^| find "="') do set %%m
@echo %Model%

Open in new window

0
Protect Your Employees from Wi-Fi Threats

As Wi-Fi growth and popularity continues to climb, not everyone understands the risks that come with connecting to public Wi-Fi or even offering Wi-Fi to employees, visitors and guests. Download the resource kit to make sure your safe wherever business takes you!

 
shyam pothiniAuthor Commented:
Thanks for the comments,
@Lee we have deployment agent, so we want to use script, But I will talk to my Boss.
@Darrel, I will try this.
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
You can hammer a nail with a screwdriver because you have it... or you can use a hammer - because you have it.  Which tool should you use?  The one that will work or the one that will work well?
0
 
shyam pothiniAuthor Commented:
Lee, I like to use AD, but its not me making decisions, anyways I am proposing it to my superiors.

@Darell,
I changed the script to test as follows and it didn't work, am I doing anything wrong
@for /f "tokens=*" %%m in ('wmic computersystem get model /value ^| find "="') do set %%m
@echo %Model%

If "%Model%" == "HP EliteBook 840 G3" then Goto 840G3
If "%Model%" == "HP EliteBook 840 G4" then Goto 840G4
If "%Model%" == "HP EliteBook 850 G4" then Goto 850G4
Goto WrongModel

:840G3
ping google.com

Goto END

:840G4
ping yahoo.com

Goto END

:850G4
timeout /t 100

Goto END

:END
0
 
Darrell PorterEnterprise Business Process ArchitectCommented:
You have to ensure the values Model is being set to match the comparison values in the script.
0
 
shyam pothiniAuthor Commented:
I ran query on each Pc and took the name from there, but I am not successful running this
0
 
shyam pothiniAuthor Commented:
Capture.PNG
its not recognizing then, Please see attached
0
 
Darrell PorterEnterprise Business Process ArchitectCommented:
Apologies

Change 'then goto' to just 'goto'
0
 
Darrell PorterEnterprise Business Process ArchitectCommented:
Have you tried making this change to the script yet?
0
 
Mladen CvijanovicNOC TechnicianCommented:
Shyam, what kind of the deployment agent do you have?
0
 
Darrell PorterEnterprise Business Process ArchitectCommented:
The author has not responded.  I proposed best solution and assisted solutions above.
0
 
shyam pothiniAuthor Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.