Jump to content

Autorun/batch Question


abferm

Recommended Posts

Hi, I'm making a DVD to install service packs on Windows machines. It will contain all service packs currently released for XP and up. I would like to make an autorun script that automatically run the installer for the next service pack for that machine. Is it possible to do this with autorun? The other option I was thinking of trying was writing a batch script to determine the OS and service pack installed. This may actually work better because I could easily run it manually if the computer had autorun disabled. So is it possible to do this with a batch script?

Link to comment
Share on other sites

Or make a menu system with Service packs per OS, then when inserting the DVD, run it and choose the OS you are in. You can probably put checks in to grab the level of service pack you are at as well, either through wmic or via registry keys if you know where to look.

wmic os get ServicePackMajorVersion
wmic os get ServicePackMinorVersion

Something I created for my self a while back, queries windows for different things and outputs to an html file. Save all this to a bat file called win-info.bat or wahtever you want:

cd \
mkdir WMIC-PC-INFO
cd WMIC-PC-INFO
wmic BIOS list full /format:htable > BIOS.html
wmic CSPRODUCT list full /format:htable > SM-BIOS.html
wmic CPU list full /format:htable > CPU-INFO.html
wmic os get ServicePackMajorVersion /format:htable > ServicePackMajor.html
wmic os get ServicePackMinorVersion /format:htable > ServicePackMinor.html
wmic COMPUTERSYSTEM list full /format:htable > COMPUTERSYSTEM.html
wmic BOOTCONFIG list full /format:htable > BOOTCONFIG.html
wmic BASEBOARD list full /format:htable > MOBO.html
wmic DISKDRIVE list /format:htable > DISK-DRIVES.html
wmic ENVIRONMENT list /format:htable > SYSTEM-ENV.html
wmic GROUP list /format:htable > GROUPS-SID.html
wmic USERACCOUNT list /format:htable > USERS-SID-STATUS.html
wmic SYSACCOUNT list full /format:htable > SYSACCOUNT-SECURITY-LIST.html
wmic SYSDRIVER list full /format:htable > SYSDRIVER-LIST.html
wmic STARTUP list full /format:htable > BASIC-STARTUP-LIST.html
wmic SHARE list full /format:htable > SHARES.html
wmic SERVICE list full /format:htable > SERVICES.html
wmic SERVER list full /format:htable > SERVER.html
wmic NIC list full /format:htable > NETWORK-ADAPTERS.html
wmic NICCONFIG list full /format:htable > NETWORK-ADAPTERS-DETAILED-INFO.html
wmic NETLOGIN list full /format:htable > NETLOGINS-INFO.html
wmic LOGICALDISK list full /format:htable > LOGICALDISK-INFO.html

echo "<html><body link='black' vlink='#666' bgcolor='white' style='color:white;font-family:arial; text-align:justify;overflow:scroll;'><div id='container' style='width:1400px; margin:0px;'><div id='menu' style='font-size:12px;float:left; width:220px;'><a href='BIOS.html' target='framed'>Bios-Info</a><br /><br /><a href='SM-BIOS.html' target='framed'>SMBios-Info</a><br /><br /><a href='BOOTCONFIG.html' target='framed'>Boot Config</a><br /><br /><a href='CPU-INFO.html' target='framed'>CPU-INFO</a><br /><br /><a href="ServicePackMajor.html">ServicePackMajor Version</a><br/ ><br /><a href="ServicePackMinor.html">ServicePackMinor Version</a><br/ ><br /><br /><br /><a href='COMPUTERSYSTEM.html' target='framed'>PC Info</a><br /><br /><a href='DISK-DRIVES.html' target='framed'>Disk Drives</a><br /><br /><a href='LOGICALDISK-INFO.html' target='framed'>Logical Disk Info</a><br /><br /><a href='SYSTEM-ENV.html' target='framed'>SYS Environment Info</a><br /><br /><a href='GROUPS-SID.html' target='framed'>GROUPS and SIDs Info</a><br /><br /><a href='USERS-SID-STATUS.html' target='framed'>Users, SIDs and Status Info</a><br /><br /><a href='SYSACCOUNT-SECURITY-LIST.html' target='framed'>SYS Security Accounts Info (Think file and folder permissions)</a><br /><br /><a href='SYSDRIVER-LIST.html' target='framed'>Driver List and Info</a><br /><br /><a href='BASIC-STARTUP-LIST.html' target='framed'>Basic Startup Programs Info</a><br /><br /><a href='SHARES.html' target='framed'>Shares Info (Requires Server, Computer Browser, Workstation and ICS  Services enabled)</a><br /><br /><a href='SERVICES.html' target='framed'>Services</a><br /><br /><a href='SERVER.html' target='framed'>Server Info (Requires Server, Computer Browser, Workstation and ICS  Services enabled)</a><br /><br /><a href='NETWORK-ADAPTERS.html' target='framed'>Network Adapters</a><br /><br /><a href='NETWORK-ADAPTERS-DETAILED-INFO.html' target='framed'>Network Adapters Details</a><br /><br /><a href='NETLOGINS-INFO.html' target='framed'>Network Logins</a><br /><br /></div><iframe name='framed' src='bios.html' style='width:1160px; height:600px; position:relative; padding-left:10px; float:left; overflow:scroll; border:0; left:5px;'>-iframe-</iframe></div></body></html>" > index.html

start index.html


Edited by digip
Link to comment
Share on other sites

All done. This should open the correct installer on any PC or open a .txt file containing an error message.

@echo off

systeminfo | find "x64-based PC" > nul
IF %ERRORLEVEL% == 0 (	
goto base_64
) ELSE (
goto base_32
)

:base_64
systeminfo | find "Windows 7" > nul
IF %ERRORLEVEL% == 0 (
goto win_764
)

systeminfo | find "Vista" > nul
IF %ERRORLEVEL% == 0 (
goto win_vista64
)

systeminfo | find "Windows XP" > nul
IF %ERRORLEVEL% == 0 (
goto win_XP64
)

goto not_detected

:win_764

systeminfo | find "Service Pack 1" > nul
IF %ERRORLEVEL% == 0 (
	goto not_here
)

.\7\64\SP1.exe

goto exit

:win_vista64
systeminfo | find "Service Pack 2" > nul
IF %ERRORLEVEL% == 0 (
	goto not_here
)

systeminfo | find "Service Pack 1" > nul
IF %ERRORLEVEL% == 0 (
	.\Vista\64\SP2.exe
)ELSE (
	.\Vista\64\SP1.exe
)

goto exit

:win_XP64
goto not_here

:base_32
:Run 32-bit command here

systeminfo | find "Windows 7" > nul
IF %ERRORLEVEL% == 0 (
goto win_7
)

systeminfo | find "Vista" > nul
IF %ERRORLEVEL% == 0 (
	goto win_vista
)

systeminfo | find "Windows XP" > nul
IF %ERRORLEVEL% == 0 (
	goto win_XP
)

goto not_detected

:win_7
systeminfo | find "Service Pack 1" > nul
IF %ERRORLEVEL% == 0 (
	goto not_here
)

.\7\32\SP1.exe

goto exit

:win_vista
systeminfo | find "Service Pack 2" > nul
IF %ERRORLEVEL% == 0 (
	goto not_here
)

systeminfo | find "Service Pack 1" > nul
IF %ERRORLEVEL% == 0 (
	.\Vista\SP2.exe
)ELSE (
	.\Vista\SP1.exe
)

goto exit

:win_XP
systeminfo | find "Service Pack 3" > nul
IF %ERRORLEVEL% == 0 (
	goto not_here
)

systeminfo | find "Service Pack 2" > nul
IF %ERRORLEVEL% == 0 (
	goto xp_sp3
)

systeminfo | find "Service Pack 1" > nul
IF %ERRORLEVEL% == 0 (
	.\Vista\SP2.exe
)ELSE (
	.\Vista\SP1.exe
)
goto exit

:xp_sp3
.\XP\SP3.exe
goto exit

:not_here
notepad notincluded.txt
goto exit

:not_detected
notepad notdetected.txt
goto exit

:exit

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...