?
Solved

needing wmic csproduct get name script for bios updates, etc

Posted on 2010-09-09
2
Medium Priority
?
910 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
2 Comments
 
LVL 39

Expert Comment

by:Krzysztof Pytko
ID: 33636455
OK, try this, open notepad put it there and asave as bat or cmd

@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 59

Accepted Solution

by:
Bill Prew earned 2000 total points
ID: 33636722
Here's how I would approach it in a BAT file.

~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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

755 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