jessica Posted May 17, 2018 Posted May 17, 2018 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 ) )
Arthur Posted May 17, 2018 Posted May 17, 2018 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... 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 1
jessica Posted May 17, 2018 Author Posted May 17, 2018 Thank you! That has worked, can't believe Dell has put so many spaces at the end
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now