Jump to content

Recommended Posts

Posted

We have a script that currently installs VirtualBox and the Extension Pack and then copy's the files down from the server onto the PC. The section of script that copy's the files over only works for the first 3 computer models. The last 2 just error out. Has anyone got any ideas what the problem might be? I've attached the section of code that it is failing on.

Thanks

 

echo Finding Computer Model
for /f "tokens=2 delims==" %%a in (
   'wmic computersystem get model /value'
) do for /f "delims=" %%b in ("%%~a") do (
   if /i "%%~b"=="OptiPlex 7440 AIO" ( 
       goto 7440
   ) else if /i "%%~b"=="OptiPlex 3240 AIO" (
       goto 7440
   ) else if /i "%%~b"=="9876-2573A" ( 
       goto zoostorm
   ) else if /i "%%~b"=="OptiPlex 3040" ( 
       goto 3040
   ) else if /i "%%~b"=="OptiPlex 780" ( 
       goto 780
   ) else (
       echo un-compatible system
       Pause
       goto :eof
   )
)

Posted
Has anyone got any ideas what the problem might be?

It's because some of Dell's models contain spaces in their names. The OptiPlex 780 definitely does...

 

JS2uIu.png

 

A quick way to check is to run the following PowerShell command and then paste it into Word or a text editor that can show invisible characters.

 

(Get-WmiObject -Class:Win32_ComputerSystem).Model | Clip

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...