Jump to content

Small script to help adding applications.


Recommended Posts

@Webmedic:

At cmdlines.txt you can't connect to a network share, because the workstation service is needed for this (which isn't loaded the the t12/t13 stage). I've only heard this.. so you might want to confirm it.

Also network drivers need to be integrated otherwise you need to install them first/reboot etcereta.

Link to comment
Share on other sites


@Webmedic:

At cmdlines.txt you can't connect to a network share, because the workstation service is needed for this (which isn't loaded the the t12/t13 stage). I've only heard this.. so you might want to confirm it.

Also network drivers need to be integrated otherwise you need to install them first/reboot etcereta.

Correct, Workstation service is running yet. I also believe you can't force it to start either ( NET command)

Link to comment
Share on other sites

@ un4given1:

No you cannot do it that way!

The cmd-files do not contain absolute paths (because you can add programs quicker that way!)

You can't? Oh, my bad... I guess the 1500+ PCs I used this for were all faking it, huh?

I meant it doesn't work in my situation! Your one isn't that flexible!

Well.. never mind!

Whatever dewd... Spent 2 years working with RIS and doing network installations using this method. Guess I have no clue what I'm talking about...

Link to comment
Share on other sites

Maybe I'm smokin' dope, but I don't see how the for /f loop applies to original scenario, either. Where does it pick off all the "!commands.cmd" file in the apps tree? It looks like it's recursively executing every file in the apps folder. I think it's in the right direction, but the code doesn't seem complete. Can you give us the complete code that would pick off the !commands.cmd files? Thanks.

Link to comment
Share on other sites

I changed it once again, so if anyone's still interested, they may want to check it out:

echo.
echo Installing items
echo ----------------------------------------------
set installDir=\\10.0.0.152\install
net use %installDir% /user:unattended unattended
if NOT %ERRORLEVEL%==0 (
 echo. Cannot connect to %installDir%
 echo. Starting CMD to assist user in finding manual address...
 start cmd
 set /p installDir=[Type manual address]
)
pushd %installDir%
for /D %%i IN (*) DO (
 if EXIST "%%i"\!install.* (
   echo.
   echo Installing "%%i"...
   if EXIST "%%i"\!install.cmd (
     pushd "%%i"
     call !install.cmd
     popd
   )
   if EXIST "%%i"\!install.reg (
     echo Adding registry information...
     regedit /s "%%i"\!install.reg
   )
 )
)
popd

I explain exactly what it does:

- It tries to connect to the %InstallDir%

- If it can't connect (when there's no network available for example):

- - - a CMD prompt is opened, so the user can check where the directory might be.

- - - the user is prompted for to enter a manual installation address. For example enter F:\ if you have the Apps on a CD.

- The current directory is changed to the %InstallDir%

- The FOR-lus executes:

- - - It checks in each subdir if a "!install.*" exists... if so then it:

- - - - - - runs "!install.cmd" if is present

- - - - - - imports "!install.reg" to the registry if is present

Note 1: This one doesn't recursively scans all dirs.., only the ones that are in the %InstallDir% path.

Note 2: If a "!install.cmd" exists, it also changes the current directory to the one where the "!install.cmd" file is, so that the commands in that file don't need to be absolute. Useful because your %InstallDir% can be anywhere this way. You don't need to know the path in advance..

[EDIT] Small fix to the "if not errorlevel ..." line [/EDIT]

Edited by Afterdawn
Link to comment
Share on other sites

I used some of this but I only have it change to the directory and then execute explode. Explode is very easy to sonfigure and use and it looks nice. The xml file it uses is no harder than a batch file really.

Thanks for the code it works perfectly though for accessing the share. I also have gotten it working durring t-12.

Thanks again.

Link to comment
Share on other sites

I used  some of this but I only have it change to the directory and then execute explode. Explode is very easy to sonfigure and use and it looks nice. The xml file it uses is no harder than a batch file really.

Thanks for the code it works perfectly though for accessing the share. I also have gotten it working durring t-12.

Thanks again.

No thanks!

How DID you get it working at the T12 stage? I cannot use Net use at this stage. It says: "Workstation not running". If I try to run it manually ( net start workstation), it reports that the service is already running :unsure:

Well I don't use it at this stage but still curious how you did it.

Also, I don't care how pretty my installation looks.. as longs as it's unattented and flexible! :thumbup

Link to comment
Share on other sites

Or you could just do it like this....
for /f %%i IN ('dir %systemdrive%\apps /b') Do @echo start "" /wait %systemdrive%\apps\%%i >>%systemdrive%\apps\apps.cmd

call apps.cmd

or even easier....

for /f %%i IN ('dir %systemdrive%\apps /b') Do @echo start "" /wait %systemdrive%\apps\%%i
been doin' it this way myself well over a year...

you can check an old post of mine and see the many ways I used to use it...

http://www.osnn.net/forum/archive/index.php/t-36648.html

Maybe I'm smokin' dope, but I don't see how the for /f loop applies to original scenario, either. Where does it pick off all the "!commands.cmd" file in the apps tree? It looks like it's recursively executing every file in the apps folder. I think it's in the right direction, but the code doesn't seem complete. Can you give us the complete code that would pick off the !commands.cmd files? Thanks.

Link to comment
Share on other sites

@ un4given1:

No you cannot do it that way!

The cmd-files do not contain absolute paths (because you can add programs quicker that way!)

You can't? Oh, my bad... I guess the 1500+ PCs I used this for were all faking it, huh?

I concur with Afterdawn. You can't. You're not getting the absolute path. Guess those 1500+ PCs are posin' if you're using that code.

Link to comment
Share on other sites

@UnderTheGun:

You're missing the "if exist". It checks for the existence of the file and executes if it is present.

But I changed it once again, so if anyone's still interested, they may want to check it out:

echo.
echo Installing items
echo ----------------------------------------------
set installDir=\\10.0.0.152\install
net use %installDir% /user:unattended unattended
if NOT ERRORLEVEL 0 (
 echo. Cannot connect to %installDir%
 echo. Starting CMD to assist user in finding manual address...
 start cmd
 set /p installDir=[Type manual address]
)
pushd %installDir%
for /D %%i IN (*) DO (
 if EXIST "%%i"\!install.* (
   echo.
   echo Installing "%%i"...
   if EXIST "%%i"\!install.cmd (
     pushd "%%i"
     call !install.cmd
     popd
   )
   if EXIST "%%i"\!install.reg (
     echo Adding registry information...
     regedit /s "%%i"\!install.reg
   )
 )
)
popd

I explain exactly what it does:

- It tries to connect to the %InstallDir%

- If it can't connect (when there's no network available for example):

- - - a CMD prompt is opened, so the user can check where the directory might be.

- - - the user is prompted for to enter a manual installation address. For example enter F:\ if you have the Apps on a CD.

- The current directory is changed to the %InstallDir%

- The FOR-lus executes:

- - - It checks in each subdir if a "!install.*" exists... if so then it:

- - - - - - runs "!install.cmd" if is present

- - - - - - imports "!install.reg" to the registry if is present

Note 1: This one doesn't recursively scans all dirs.., only the ones that are in the %InstallDir% path.

Note 2: If a "!install.cmd" exists, it also changes the current directory to the one where the "!install.cmd" file is, so that the commands in that file don't need to be absolute. Useful because your %InstallDir% can be anywhere this way. You don't need to know the path in advance.

@Afterdawn

This code and documentation rocks!!!! I'd like to try to get it to work with apps spanned over multiple CD/DVDs. Will post if it works. That would make it a low maintenance solution because you don't have to mess with anymore scripts on the XP CD, just in your folders for all your new apps. I can't use the file server solution because I work with a variety of classified networks that are of varying classifications, so I'm stuck with the disk swapping.

Link to comment
Share on other sites

Maybe I'm smokin' dope, but I don't see how the for /f loop applies to original scenario, either. Where does it pick off all the "!commands.cmd" file in the apps tree? It looks like it's recursively executing every file in the apps folder. I think it's in the right direction, but the code doesn't seem complete. Can you give us the complete code that would pick off the !commands.cmd files? Thanks.

I already didn't really understand your question, but now I know this question wasn't directed to me. It was a question for un4given1... Pfew figured that out :)

Good to hear that (pieces of) my script come to good use of you!

Link to comment
Share on other sites

@ un4given1:

No you cannot do it that way!

The cmd-files do not contain absolute paths (because you can add programs quicker that way!)

You can't? Oh, my bad... I guess the 1500+ PCs I used this for were all faking it, huh?

I concur with Afterdawn. You can't. You're not getting the absolute path. Guess those 1500+ PCs are posin' if you're using that code.

I'm not gonna argue with all of you. I have been doing unattended installs for over 3 years, even before it became this big fad on all of the forums. I was interviewed by Jerry Honeycutt (know who he is? Microsoft Press) about my "unique" methods for RIS installations, and I will be in one of his upcomming books about RIS. So, I don't need some 6 post newb to argue with me. Check my past posts... they speak for themselves.

Link to comment
Share on other sites

I used  some of this but I only have it change to the directory and then execute explode. Explode is very easy to sonfigure and use and it looks nice. The xml file it uses is no harder than a batch file really.

Thanks for the code it works perfectly though for accessing the share. I also have gotten it working durring t-12.

Thanks again.

No thanks!

How DID you get it working at the T12 stage? I cannot use Net use at this stage. It says: "Workstation not running". If I try to run it manually ( net start workstation), it reports that the service is already running :unsure:

Well I don't use it at this stage but still curious how you did it.

Also, I don't care how pretty my installation looks.. as longs as it's unattented and flexible! :thumbup

well I could tell you but you dont really seem interested. Or are you. Or did I understand no thanks properly.

At any rate I can even post screenies if you want.

If you are referring to xplode. Well like you I was doing everything mostly with batch files and some inf files to make it look perty but to be honest xplode works over a network and the xml is dead simple it is much easier ot maintian than a bunch of text files. It even has a silent mode for installing sliently. This comes in handy if you run a whole office and would like to push updates to clients systems in the morning when they first log in.

Since I do this for a living I did weigh the cost first.

Link to comment
Share on other sites

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
  • Recently Browsing   0 members

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