Solved

Need wmic csproduct get name script for BIOS update, etc

Posted on 2010-09-09
3
1,413 Views
Last Modified: 2012-05-10
I'm needing some sort of script that I can run against 3 models of computers, and say "if wmic csproduct get name = 755 optiplex, run this......., and this. If wmic csproduct name = optiplex 620 run this, and this.
Basically just having to update bios and its settings, plug some power management settings on the NIC. I'm not the greatest scripter, but know what I'm needing. Any help is appreciated!
0
Comment
Question by:khptech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 39

Expert Comment

by:Krzysztof Pytko
ID: 33636456
@echo off

wmic csproduct get name >#

findstr /i "755 optiplex" "#"

if %errorlevel%==1 goto install1

findstr /i "optiplex 620" "#"

if %errorlevel%==1 goto install2

:install1

run_file1.exe
goto end_script

:install2

run_file2.exe
goto end_script

:end_script
0
 
LVL 5

Expert Comment

by:MaxSoullard
ID: 33636480
Let me know if I am wrong, but I think you are trying to get the computer model. If this is the case this is a vb script that does that.

You will then need to adapt your if statments to match the correct names provided by the computer manufacturer
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colSettings = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
For Each objComputer in colSettings 
    Wscript.Echo  objComputer.Model
Next

Open in new window

0
 
LVL 54

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 33636705
Here's how I would approach it in a BAT file.  It uses WMIC to get the product name, and then based on that value can perform any needed logic.

~bp
@echo off
for /F "skip=2 tokens=2 delims=," %%A in ('wmic csproduct get name^,version /format:csv') do (
  if /I "%%A" EQU "755 optiplex" (
    REM insert processing needed here
    exit /b
  )
  if /I "%%A" EQU "optiplex 620" (
    REM insert processing needed here
    exit /b
  )
)

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Powershell script + checking for a process and determining cpu or memory 16 96
VBScript Write Column Headers 3 46
Convert .csv to tab delimited text 11 50
Odd Coloration 4 21
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question