Avatar of khptech
khptechFlag for United States of America

asked on 

Need wmic csproduct get name script for BIOS update, etc

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!
Microsoft DOSJScriptVB Script

Avatar of undefined
Last Comment
Bill Prew
Avatar of Krzysztof Pytko
Krzysztof Pytko
Flag of Poland image

@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
Avatar of MaxSoullard
MaxSoullard
Flag of United Kingdom of Great Britain and Northern Ireland image

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

ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
VB Script
VB Script

VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.

39K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo