CypherBit Posted October 8, 2007 Posted October 8, 2007 I'm trying to deploy XP SP2 with a base install of applications and am doing so through RunOnceEx That part works, but I want to install additional software on a particular laptop, workstation. I only have four types of Dell machines.At the end of RunOnceEx I'd like to do a query using WMIC - wmic baseboard get product and do an if statement. Basically if wmic output matches 0KU184 (that's a Latitude D630) it should run another batch file that would install D630 specific applications if it doesn't match then it should compare it to all the other codes I have (for D630, GX620,...).I really don't know how to better describe it, since my knowledge of wmic and even more if statements is very low. It should be something like this:if "wmic baseboard get product"=="0KU184" run d630.bat if not see if it matches 0KX350 (D620) and so on and so on. I have 10 codes like that (for the four Dell machine types).Any assistance would be greatly appreciated.
Yzöwl Posted October 8, 2007 Posted October 8, 2007 Something like this perhaps!@echo offfor /f "skip=1" %%? in ('wmic baseboard get product') do ( if %%?' equ 0KU184' (call d630.cmd) else ( if %%?' equ X0X0X0' (call gx620.cmd) else ( if %%?' equ X0XX0X' (call xxnnn.cmd) else ( if %%?' equ 0X0X0X' (call xnnn.cmd) else ( echo/ no match found&&ping -n 6 127.0.0.1>nul)))))
CypherBit Posted October 8, 2007 Author Posted October 8, 2007 Yzöwl thank you very much, this seems to be exactly what I've been after.Now I just need to incorporate this into my RunOnceEx.
CypherBit Posted October 9, 2007 Author Posted October 9, 2007 I've put together this:@echo offfor /f "skip=1" %%? in ('wmic baseboard get product') do ( if %%?' equ 0TD761' (call d620.cmd) else ( if %%?' equ 0KX350' (call d620.cmd) else ( if %%?' equ 0JK187' (call d620.cmd) else ( if %%?' equ 0FT292' (call d620.cmd) else ( if %%?' equ 0KU184' (call d630.cmd) else ( if %%?' equ 0HH807' (call gx620.cmd) else ( if %%?' equ 0F8096' (call gx620.cmd) else ( if %%?' equ 0FH884' (call gx620.cmd) else ( if %%?' equ 0WF810' (call 745.cmd) else ( if %%?' equ 0RF705' (call 745.cmd) else ( if %%?' equ 0KG317' (call 745.cmd) else ( echo/ no match found&&ping -n 6 127.0.0.1>nul)))))but for some reason it won't return anything (most of the time). I tried multiple OS's, computers.Even the before posted code sometimes just doesn't provide any results. Also if I just run wmic I get nothing. Restarting cmd prompt helps with just wmic, but the batch files just don't provide the result on a consistent basis.Any idea what's wrong?
Yzöwl Posted October 9, 2007 Posted October 9, 2007 In the first instance you will need to fix the code you've supplied!You've failed to close all of the paraetheses.The last line should say echo/ no match found&&ping -n 6 127.0.0.1>nul))))))))))))
CypherBit Posted October 9, 2007 Author Posted October 9, 2007 Thank you yet again Yzöwl.I changed it accordingly and the batch file still wouldn't run properly. It seems that the batch file name of wmic.cmd has something to do with it. I rename that to anything else and it works as it should.
cluberti Posted October 10, 2007 Posted October 10, 2007 Thank you yet again Yzöwl.I changed it accordingly and the batch file still wouldn't run properly. It seems that the batch file name of wmic.cmd has something to do with it. I rename that to anything else and it works as it should.Try to avoid naming program files or batch files after files on the system that already exist, unless you're passing the entire path to the file when calling it .
CypherBit Posted October 10, 2007 Author Posted October 10, 2007 Try to avoid naming program files or batch files after files on the system that already exist, unless you're passing the entire path to the file when calling it .Lesson learned I came across another problem. Hopefully I won't make a mess if I continue with it in this post.This is my RunOnceEx (I left out most of it since the middle part isn't all the important. All the software installs without issues) which is executed from cmdlines.txt:@echo offcwnd /hide @SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY% /V TITLE /D "Installing Applications" /fREG ADD %KEY%05 /VE /D ".NET Framework 1.1 + SP1 + KB928366" /fREG ADD %KEY%05 /V 1 /D "%systemdrive%\install\applications\dotnet11\dotnetfx.exe /q /c:\"install /q\"" /fREG ADD %KEY%05 /V 2 /D "%systemdrive%\install\applications\dotnet11\NDP1.1sp1-KB867460-X86.exe /q" /fREG ADD %KEY%05 /V 3 /D "%systemdrive%\install\applications\dotnet11\NDP1.1sp1-KB928366-X86.exe /q" /fREG ADD %KEY%\105 /VE /D "Windows Media Player 10.0" /fREG ADD %KEY%\105 /V 1 /D "%systemdrive%\install\applications\WMP10\mpsetupedp.msi /quiet /norestart" /fREG ADD %KEY%\110 /VE /D "Installing model specific applications" /fREG ADD %KEY%\110 /V 1 /D "%systemdrive%\install\models.cmd" /fEXITMy models.cmd (which is situated in %systemdrive%\install):@echo offfor /f "skip=1" %%? in ('wmic baseboard get product') do ( if %%?' equ 0TD761' (call d620.cmd) else ( if %%?' equ 0KX350' (call d620.cmd) else ( if %%?' equ 0JK187' (call d620.cmd) else ( if %%?' equ 0FT292' (call d620.cmd) else ( if %%?' equ 0KU184' (call d630.cmd) else ( if %%?' equ 0HH807' (call gx620.cmd) else ( if %%?' equ 0F8096' (call gx620.cmd) else ( if %%?' equ 0FH884' (call gx620.cmd) else ( if %%?' equ 0WF810' (call 745.cmd) else ( if %%?' equ 0RF705' (call 745.cmd) else ( if %%?' equ 0KG317' (call 745.cmd) else ( echo/ no match found&&ping -n 6 127.0.0.1>nul))))))))))))And for example d620.cmd (also in %systemdrive%\install):@echo offcwnd /hide @SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY% /V TITLE /D "Installing Latitude D620 Specific Applications" /fREG ADD %KEY%05 /VE /D "Cisco VPN Client 4.8.01.0300" /fREG ADD %KEY%05 /V 1 /D "%systemdrive%\install\applications\VPN\vpnclient_setup.msi REBOOT=Supress /qb" /fREG ADD %KEY%10 /VE /D "iPass 3.51 Build 107" /fREG ADD %KEY%10 /V 1 /D "%systemdrive%\install\applications\iPass\iPassClient.exe -s -a -s" /fREG ADD %KEY%15 /VE /D "Cleaning Up and Rebooting" /fREG ADD %KEY%15 /V 1 /D "%systemdrive%\install\cleanup.cmd" /fEXITI'm testing this in Virtual PC 2007. The problem is models.cmd or d620.cmd aren't being executed properly during the install. I replaced one of the codes for the d620 in models.cmd with equ Virtual' so the above d620.cmd should be in my RunOnceEx.cmd but it is not.If I manually run models.cmd after all is done, the entries in RunOnceEx do appear and subsequently the software installs without problems.Any suggestions? Doesn't RunOnceEx run twice, have I made some other error somewhere and fail to see it,...?
Yzöwl Posted October 10, 2007 Posted October 10, 2007 The way you currently have it set up is that the Model specific stuff is being set for installation on the next reboot after your initial first logon session.
CypherBit Posted October 10, 2007 Author Posted October 10, 2007 The way you currently have it set up is that the Model specific stuff is being set for installation on the next reboot after your initial first logon session.Yes, but it doesn't appear in RunOnceEx (everything that is specified in d620.cmd). Shouldn't it be there after 1st logon? Then I'd just need another reboot and everything would install. I'll make it restart automatically once it does that)
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