Jump to content

Doc Symbiosis

Member
  • Posts

    333
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Germany

Posts posted by Doc Symbiosis

  1. After a while of work, I now came to the for my purposes modified WPI.cmd, which I would declare as usable. I definitely wanted to avoid problems with UNC paths, cause I ran into problems with some installers ( even with firefox ).

    So the cmd detects, if it is called with UNC path, then connects the last free drive letter and sets the environment variables %wpipath% and %installdir% appropriate. There is no check implemented, if a drive letter is free, cause in real life, I nearly never saw a system with no drive letter free ( I saw tthis for the first time in my life, when I tested the batch, cause the drive is disconnected, after next restart ).

    To use the %installdir% in the config.js, one would have to modify the generate.js in an adequate way. So hers's the cmd

    @ECHO OFF
    REM Set wpipath to the path where this batch is located
    SET "wpipath=%~dp0"

    REM If wpipath is a UNC path, connect the share to the last free drive letter and set wpipath appropriate
    IF "%~d0" EQU "\\" (
    REM Get the name of the share, assuming that it is not longer than 50 characters
    FOR /F "tokens=1,2* delims=\" %%i IN ('ECHO %~dp0') DO (
    IF NOT %%k!==! (
    call :setnewpath \\%%i\%%j "%%k"
    ) ELSE (
    call :setnewpath \\%%i\%%j
    )
    )
    )

    REM Hide the current window
    REM %wpipath%\Tools\cmdow.exe @ /hid

    REM Force resolution to needed size for wpi interface.
    REM %wpipath%\Tools\ResChange.exe -width=1280 -height=1024 -depth=max -refresh=max

    REM Font installation - the smooth and customizable way.
    REM start /wait %wpipath%\Tools\Fonts\FontInstaller.exe

    REM Special registry tweak needed.
    regedit /s %wpipath%\Common\WPI.reg

    REM Set the environment variable for the directory of the setup files
    SET installdir=%wpipath%Install\

    REM Start WPI and wait for it to end.
    %wpipath%\WPI.hta

    REM Undo registry tweak.
    regedit /s %wpipath%\Common\Undo.reg

    REM Clean up script.
    REM %drive%\$OEM$\CleanUp.cmd

    REM Remove the environment variable
    SET wpipath=

    REM Rebooting the sytem to finalize the installation process.
    REM shutdown.exe -r -f -t 60 -c "To finish installations WPI will now reboot in 60 sec..."

    EXIT

    :setnewpath
    FOR /F "TOKENS=2" %%i IN ('NET USE * %1 /PERSISTENT:NO ^|FIND "Drive"') DO (SET wpipath=%%i\%2)

    EDIT: Added the "set wpipath=" line to cleanup

    Wpi.cmd

  2. Thanks Yzöwl for the batch. The IF DEFINED statement doesn't work for me, but your batch helped me to modify my own batch with using the call command. It now looks like this( I removed the setlocal, because I really want to set wpidir as environment variable

    @ECHO OFF
    SET "wpidir=%~dp0"
    IF "%~d0" EQU "\\" (
    REM Get the name of the share, assuming that it is not longer than 50 characters
    FOR /F "tokens=1,2* delims=\" %%i IN ('ECHO %~dp0') DO (
    IF NOT %%k!==! (
    call :setnewpath \\%%i\%%j "%%k"
    ) ELSE (
    call :setnewpath \\%%i\%%j
    )
    )
    )
    ECHO %wpidir%
    GOTO :EOF

    :setnewpath
    FOR /F "TOKENS=2" %%i IN ('NET USE * %1 /PERSISTENT:NO ^|FIND "Drive"') DO (SET wpidir=%%i\%2)
    GOTO :EOF

    Anyway, I only can say it another time, like so often before: thanks a lot.

  3. I think WPI uses the runonceex key to start the installations. The entries are normally run atfer the next restart, but WPI calls them directly, so that a restart isn't necessary.If the computer is restarted before all entries are processed, the remaining entries are processed after the restart. So it shouldn't be a problem to restart the computer before all entries are processed.

    To this whole description, I've got to say, that I've never tested this, it's all about how I think it should work.

  4. Hi there,

    I've got a little problem understanding the set command within loops. Here is my script which works fine

    @ECHO OFF
    SET wpidir=%~dp0

    IF %wpidir:~0,2%!==\\! (
    REM Get the name of the share, assuming that it is not longer than 50 characters
    FOR /F "tokens=1,2* delims=\" %%i IN ('ECHO %~dp0') DO (
    SET share=\\%%i\%%j
    SET wpipathpart=%%k
    )
    )
    IF %wpidir:~0,2%!==\\! (
    REM connect to the last free drive letter and write it to drvlet
    FOR /f "usebackq tokens=2* eol=" %%i IN (`net use * %share% /PERSISTENT:NO`) DO (
    SET drvlet=%%i
    GOTO endfor
    )
    :endfor
    SET wpidir=%drvlet%\%wpipathpart%
    )
    )
    ECHO %wpidir%
    Set drvlet=
    Set share=
    Set wpipathpart=

    This script just checks, if the batch is called with UNC path and in this case connects the share to last free drive letter and sets the directory adequate. Problem is, that when I remove the lines 11 and 12 ( cause two if statements with same condition aren't that nice )

    )
    IF %wpidir:~0,2%!==\\! (

    the %share% variable isn't set within the loop. Anyone got an idea, how I can fix this and what's going wrong?

  5. You could entry the files in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager under the REG_EXPAND_SZ value PendingFileRenameOperations. Then the files are deleted after next restart.

    Just google for the value name and you'll find enough explanations.

    Of course, you also could run a batch through runonceex, but I prefer first method, cause you don't need to call a batch with this.

  6. This is the network part of my winnt.sif:

    [Networking]
    InstallDefaultComponents=No

    [NetAdapters]
    Adapter1=params.Adapter1

    [params.Adapter1]
    INFID=*

    [NetClients]
    MS_MSClient=params.MS_MSClient

    [NetServices]
    MS_SERVER=params.MS_SERVER

    [NetProtocols]
    MS_TCPIP=params.MS_TCPIP

    [params.MS_TCPIP]
    DNS=No
    UseDomainNameDevolution=No
    EnableLMHosts=Yes
    AdapterSections=params.MS_TCPIP.Adapter1

    [params.MS_TCPIP.Adapter1]
    SpecificTo=Adapter1
    DHCP=No
    IPAddress=172.16.1.5
    SubnetMask=255.255.255.0
    DefaultGateway=172.16.1.254
    DNSServerSearchOrder=172.16.1.254, 134.76.10.46
    NetBIOSOptions=0

    Don't know how to configure a second adapter, but should be done by dublicating the last section and modify it and add the second adapter everywhere the first is mentioned ( e.g. under [NetAdapters])

  7. @lawrenca: Sure I'm willing to help, allthough my time is a little short the following weeks. But I just have one little question: What is the kTools.exe for?

    Anyway, I'm just working on a way to inplement the indepedence of the path directly into the generate.js, so that one don't have to use any entries in the registry.

  8. This batch should be no problem just use the xcopy command to copy the profiles and the cacls command to set the user permissions like you want them to be.

    if you use the /O switch within the xcopy command, the ACLs are copied aswell, so that normally you don't have to set any further permissions.

    In batches, I normally use the /OHEICK switch, when I want to copy a whole folder with ACLs.

  9. Hi Asin,

    here a little explanation to the for loop ( i hope it is not to confusing ):

    The command "net use * \\server\share /PERSISTENT:NO" connects the share to last free drive letter

    The for loop would process every line of the output of the command, if there wouldn't be the goto :endfor

    But because of the goto :endfor, only the first line, which already contains the drive letter is processed.

    The usebackq options just changes the use of ' and ". The tokens=2* says that the second word is written to the variable %%i, the * within says, that the rest is written to variable %%j.

    I hope this makes the batch a little more clear, I you've got any questions left, don't be shy to ask again

  10. AS personal firewall I prefer using kerio, perhaps you can give it a shot.

    For the restoring I think driveimage is good choice, allthough personally, I prefer using Norton ( or now Symantec ) Ghost( cause they did unbelievable DOS-bootdisks with network and USB support, but I tink it's rather alike driveimage. There also exists a nice program called drive snapshot, which has the advantage, that you can create a snapshot with a running system. I was very scectical, when I first used it, but have made very good experiences til now.

  11. To which location the apps install, depends on the installer of the application, Most of them simply install to the %PROGRAMFILES% folder, some of them always install to c:\Program Files.

    If you want to install them to another location by default, I would recommend to change the %PROGRAMFILES% directory to this location, because not all installers give the opportunity to change the installation directory within a silent installation.

  12. What about changing the location for My Documents for the defualt user's profile? You can do this by editing the following regvalue:

    HKU\.Default\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal.

    So you can make sure, that every new user has automatically his My documents folder on D:

×
×
  • Create New...