Help - Search - Members - Calendar
Full Version: Tip for running WPI from network-share...
MSFN Forums > Member Contributed Projects > Windows Post-Install Wizard (WPI)

   
Google Internet Forums Unattended CD/DVD Guide
AlBundy33
If you want to run WPI from a network-share I found a simple solution.
pre-condition is that you don't use absolute path-names in your commands - you have to use variables like %CDROM% or %WPIPATH%.

If you use such variables you can use the following Script to run WPI from a network-share.

CODE
@ECHO OFF

::This should be the path to WPI on the share
SET SHARE=\\SERVER\SHARE

::mount share to a free drive and change directory to it. After Script it finished the drive will be unmounted
PUSHD "%SHARE%"
START /wait WPI.hta
POPD


That's all

Greetings

Al
JuMz
WOAH! Never knew this command existed!! I could have used this a long time ago! Just for completeness, here is what PUSHD does:


CODE
PUSHD [path | ..]

  path        Specifies the directory to make the current directory.

If Command Extensions are enabled the PUSHD command accepts
network paths in addition to the normal drive letter and path.
If a network path is specified, PUSHD will create a temporary
drive letter that points to that specified network resource and
then change the current drive and directory, using the newly
defined drive letter.  Temporary drive letters are allocated from
Z: on down, using the first unused drive letter found.


Awesome tip! Thanks
AlBundy33
Thanks for your reply - I forgot that PUSHD needs enabled command extensions because they are enabled by default at my system.

With this script the extension will be enabled for the execution.
CODE
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

SET SHARE=\\SERVER\SHARE

TITLE Running WPI from "!SHARE!"...

PUSHD "!SHARE!"
ECHO.Mounting "!SHARE!" to "!CD!"...

PUSHD WPI
ECHO.Starting WPI...
START /wait wpi.hta
POPD

ECHO.Unmounting network-drive...
POPD


Greetings

Al
Djé
QUOTE (AlBundy33 @ Jun 19 2006, 08:11 PM) *
I forgot that PUSHD needs enabled command extensions because they are enabled by default at my system.
[...]
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
[...]


* Very good trick indeed.
- Please note that extensions are enabled by default on ALL winXP systems.
So if you didn't change it, no worry.
Now, you're true, we can just keep 'SETLOCAL ENABLEEXTENSIONS' at the top of the script to be sure.
- On the other hand, I don't recommand enabling delayed expension (off by default) if you don't require it.
In some situations this can bring more mess than solve issues. You script doesn't require it.
Also note that even with ENABLEDELAYEDEXPANSION, you can still use '%' as a variable marker: only those marked with '!' have their expansion delayed, though.

* There may be another issue when using WPI from a network share if WPI itself is on the share:
you need to lower the security in order to run unsigned programs (WPI itself) without the "Open file" security Warning.
CODE
SET "KEYD=HKCU\Software\Microsoft\Internet Explorer\Download"
SET "KEYP=HKCU\Software\Microsoft\Windows\CurrentVersion\Policies"
REG add "%KEYD%" /v "CheckExeSignatures" /d "no" /f
REG add "%KEYD%" /v "RunInvalidSignatures" /t "REG_DWORD" /d 1 /f
REG add "%KEYP%\Attachments" /v "SaveZoneInformation" /t "REG_DWORD" /d 1 /f
REG add "%KEYP%\Associations" /v "LowRiskFileTypes" /d ".cmd;.exe;.hta;" /f
- From my experience, if you run WPI at RunOnceEx, you need to run the above script from T12: running it just before WPI @RunOnceEx fails.
- It may be a good idea to reverse to higher security for HKCU, HKU/.DEFAULT and the Default User's hive once the programs are installed. For example in cleanup.cmd from RunOnceEx.
- In the "LowRiskFileTypes", put whatever extension(s) you use from the share, outside of WPI: WPI deals with the inside ones.

* Also, you CAN use WPI from a network share with absolute paths:
you just have to map the network drive to that path:
CODE
NET USE Z: \\DJE\XPCD\install
and then in WPI, have your commands like:
CODE
Z:\myprog.exe -switch
But it may be less convenient than your method. Which I'm gonna investigate further right now. thumbup.gif
systemsmb
This is a great script...thanks.

I get an error when I run it though. It says bad username or password.

Can you enter domain logon username and password into the script?

Thanks in advance?

Systemsmb
zorphnog
You can enter authentication using the net use command. Net use will map the share to a specified drive with the authentication you want. Here's the syntax.

CODE
The syntax of this command is:

NET USE
[devicename | *] [\\computername\sharename[\volume] [password | *]]
        [/USER:[domainname\]username]
        [/USER:[dotted domain name\]username]
        [/USER:[username@dotted domain name]
        [/SMARTCARD]
        [/SAVECRED]
        [[/DELETE] | [/PERSISTENT:{YES | NO}]]

NET USE {devicename | *} [password | *] /HOME

NET USE [/PERSISTENT:{YES | NO}]

//An example
NET USE z: \\MyNAS\public MyPassword /USER:MyNAS\Admin
AlBundy33
Just a modified version of my script:
CODE
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

SET SHARE=
IF NOT "%~1"=="" SET SHARE=%~1

IF "%SHARE%"=="" (
    TITLE Running local WPI...
    CALL :RUN
) ELSE (
    TITLE Running WPI from "!SHARE!"...
    PUSHD "!SHARE!"
    ECHO.Mounting "!SHARE!" to "!CD!"...
    CALL :RUN
    ECHO.Unmounting network-drive...
    POPD
)

GOTO :END

:RUN
    PUSHD WPI
    ECHO.Starting WPI...
    START /wait wpi.hta
    POPD
    GOTO :END

:END


Put this script (RunWPI.cmd) to WPI-parent-directory (in WPI it's called %ROOT%).
If you start the script without arguments your local WPI will be started - but if you start the script with an share (e.g. \\SERVER\SHARE) as argument, WPI will be started from SHARE (\\SERVER\SHARE must contains WPI).

Best regards

Al
ty628659
I would like use WPI for batch software install in network share, here is my network like:
\\Server\Share\PerfectDISK
...................... \Nero
...................... \RegFiles
...................... \WPI\Audio
...................... \WPI\Common
...................... \....
...................... \WPI\runWPI.cmd
...................... \WPI\WPI.hta

and i copy Al script, and set "share=\\Server\share" in runWPI.cmd file (in network WPI root folder- No cd-rom), when i startup runWPI.cmd , the network map worked OK, but no installration action at all. must be something wrong in cmd1 map path

wacko.gif Would you please someone can help me welcome.gif


<< sample config.js >>
....
....
pn=1;
prog[pn]=['PerfectDisk'];
desc[pn]=[''];
uid[pn]=['PERFECTDISKVER80'];
dflt[pn]=['yes'];
cat[pn]=['Applications'];
forc[pn]=['no'];
cmd1[pn]=['"Z:\\PerfectDisk\\setup.exe"'];
pn++;

...
...
AlBundy33
At first I would suggest to use %ROOT% instead of Z:
CODE
pn=1;
prog[pn]=['PerfectDisk'];
desc[pn]=[''];
uid[pn]=['PERFECTDISKVER80'];
dflt[pn]=['yes'];
cat[pn]=['Applications'];
forc[pn]=['no'];
cmd1[pn]=['"%ROOT%\\PerfectDisk\\setup.exe"'];
pn++;

because %ROOT% is the upper level to the WPI-Dir (WPI\..\) - so you can be sure the everytime the correct path to your apps is used.

An if an app is not correctly installed have a look WPI_Log.txt

Al
JuMz
Has there been any changes in the new WPI on how to run it from a network? i.e. I map a drive letter , say 'Z' to the root of my installation source which contains the WPI folder:

(sharename)Z:
\WPI
\I386
\Applications
...etc

My config.js has entries like : "%CDROM%\Applications\appname\appinstaller.exe"

I want to make ONE version of WPI that can be ported to either network installs or CD/DVD/USBKEY based installs....

How should I proceed or what should I change....

mapping the drive to the share above does NOT seem to work for me...WPI fails to install...
AlBundy33
At first I would suggest to change %CDROM% to %ROOT% because %ROOT% is the upper-level of the WPI-folder.

With this setting you can start WPI from every place.
If you want to start WPI from a network-share you can use this batch-file
CODE
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

SET SHARE=
IF NOT "%~1"=="" SET SHARE=%~1

IF "%SHARE%"=="" (
    TITLE Running local WPI...
    PUSHD "%~dp0"
    CALL :RUN
    POPD
) ELSE (
    TITLE Running WPI from "!SHARE!"...
    PUSHD "!SHARE!"
    ECHO.Mounting "!SHARE!" to "!CD!"...
    CALL :RUN
    ECHO.Unmounting network-drive...
    POPD
)

GOTO :END

:RUN
    PUSHD WPI
    ECHO.Starting WPI...
    START /wait "%WINDIR%\mshta.exe" wpi.hta
    POPD
    GOTO :END

:END


Put this file in your share-folder (where wpi, i386, applications, ... exist).
If you start this batch file locally it will start you wpi.
if you start it from the share it should start wpi from the share - if there are problems copy the file to the remote-pc and change the line SET SHARE= to SET SHARE=\\YOUR_SERVER\YOUR_WPI_SHARE and it should work.

Al
JuMz
Thank you! All I needed to do was change %CDROM% to %Root% and it now works via network and CDROM. Now to test USB...

BTW, can PUSHD take username / password for network share?
AlBundy33
As far as I know: no. :-(
PUSHD is like CD but it can handle UNC-paths - and as far as I know there is no possibility to add username and password to an UNC-path.

"net use" can take username and password but with this command you have to determine a free drive-letter by yourself.

Al
JuMz
ahh I see. I know net use * will auto assign the drive letter...the question is....can I somehow obtain which drive letter it chooses...

USB key works! Yes!
AlBundy33
You can do it so:
CODE
FOR /F "tokens=2" %%D IN ('net use * "!SHARE!"^|FINDSTR /I Laufwerk') DO SET DRIVELETTER=%%D

This is my output of net use * "!SHARE!"
CODE
Laufwerk T: ist jetzt mit \\home\system verbunden.

Der Befehl wurde erfolgreich ausgeführt.

So you have to change the "Laufwerk" in my first command to the first letter before the drive-letter - this word is used to find only the first line of the output.
token=2 means to take the second word of the output.

Al
AlBundy33
Could you please try this script (but don't forget to change the FINDSTR-command).
CODE
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

SET SHARE=
SET USERNAME=
SET PASSWORD=
IF NOT "%~1"=="" SET SHARE=%~1

IF "%SHARE%"=="" (
    TITLE Running local WPI...
    PUSHD "%~dp0"
    CALL :RUN
    POPD
) ELSE (
    TITLE Running WPI from "!SHARE!"...
    IF NOT "!PASSWORD!"=="" SET ARGUMENTS=!ARGUMENTS! "!PASSWORD!"
    IF NOT "!USERNAME!"=="" SET ARGUMENTS=!ARGUMENTS! /USER:"!USERNAME!"
    FOR /F "tokens=2" %%D IN ('NET USE * "!SHARE!" !ARGUMENTS!^|FINDSTR /I Laufwerk') DO  SET DRIVELETTER=%%D
    IF "!DRIVELETTER!"=="" (
        PUSHD "!SHARE!"
    ) ELSE (
        PUSHD "!DRIVELETTER!"
    )
    ECHO.Mounting "!SHARE!" to "!CD!"...
    CALL :RUN
    ECHO.Unmounting network-drive...
    POPD
    IF NOT "!DRIVELETTER!"=="" (
        NET USE "!DRIVELETTER!" /DELETE
    )
)

GOTO :END

:RUN
    PUSHD WPI
    ECHO.Starting WPI...
    START /wait "%WINDIR%\mshta.exe" wpi.hta
    PAUSE
    POPD
    GOTO :END

:END
JuMz
It worked perfectly! To the T! Nice work buddy!
AlBundy33
Thanks.
AlBundy33
New Version:
CODE
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

SET SHARE=
SET USERNAME=
SET PASSWORD=
SET HIDEWINDOW=no
IF NOT "%~1"=="" SET SHARE=%~1

IF "%SHARE%"=="" (
    TITLE Running local WPI...
    PUSHD "%~dp0"
    CALL :RUN
    POPD
) ELSE (
    TITLE Running WPI from "!SHARE!"...
    IF NOT "!USERNAME!"=="" IF "!PASSWORD!"=="" SET /P PASSWORD=Passwort fuer !USERNAME! @ !SHARE!:
    IF NOT "!PASSWORD!"=="" SET ARGUMENTS=!ARGUMENTS! "!PASSWORD!"
    IF NOT "!USERNAME!"=="" SET ARGUMENTS=!ARGUMENTS! /USER:"!USERNAME!"
    SET ARGUMENTS=!ARGUMENTS! /PERSISTENT:YES
    FOR /F "tokens=2" %%D IN ('NET USE * "!SHARE!" !ARGUMENTS!^|FINDSTR /I Laufwerk') DO  SET DRIVELETTER=%%D
    IF "!DRIVELETTER!"=="" (
        PUSHD "!SHARE!"
    ) ELSE (
        PUSHD "!DRIVELETTER!"
    )
    ECHO.Mounting "!SHARE!" to "!CD!"...
    CALL :RUN
    ECHO.Unmounting network-drive...
    POPD
    IF NOT "!DRIVELETTER!"=="" (
        NET USE "!DRIVELETTER!" /DELETE
    )
)

GOTO :END

:RUN
    PUSHD WPI
    ECHO.Starting WPI...
    IF /I "%HIDEWINDOW%"=="yes" IF EXIST Tools\cmdow.exe Tools\cmdow.exe @ /HID
    START /wait "%WINDIR%\mshta.exe" wpi.hta
    POPD
    GOTO :END

:END


Changes:
1. now it's possible to hide the command-window if cmdow.exe exists in WPI\Tools
2. share is mounted persistent (for restart-reasons)
3. username and password can set for password-protected shares
4. if only username is set the script will ask for password

users with a non-german Windows have to replace FINDSTR /I Laufwerk with FINDSTR /I ?????.
????? is the first word in the first line of the output of the net-user-command with your share.
This is my command with output:
CODE
net use * \\home\system
Laufwerk Z: ist jetzt mit \\home\system verbunden.

Der Befehl wurde erfolgreich ausgeführt.


Greetings

Al
9h0s7
I think you guys are making this more difficult then it is lol. Or maybe I just like my way better. Here's my two cents. Set WPI to use UNC (i.e. \\pcname\nero\install.exe or w/e). Use batch file to copy all files under wpi directory to local disk. use AutoIt to start the batch file and start wpi when done copying. after wpi has finished have it run another batch to delete wpi folder (if so desired) and then delete itself.
Jbenke
I didn't know it was really that hard to run it from the network. I have the exact same versions on cd and the network. I just copyied it up there with the directory strucure, Unattended, which contains the wpi.ico and autorun, (truthfully this directory name doesn't matter) then wpi\all the normal stuff. Then when I want to use it I just map a local drive letter to \\server\unattended and the autorun in the unattended directory kicks off and the wpi behaves as if it were on a cd. If the autorun doesn't kick I just go hit the wpi.hta and it goes. Have yet to notice any issues.
mrtyler
QUOTE (9h0s7 @ Sep 12 2007, 01:28 PM) *
I think you guys are making this more difficult then it is lol. Or maybe I just like my way better. Here's my two cents. Set WPI to use UNC (i.e. \\pcname\nero\install.exe or w/e). Use batch file to copy all files under wpi directory to local disk. use AutoIt to start the batch file and start wpi when done copying. after wpi has finished have it run another batch to delete wpi folder (if so desired) and then delete itself.


I think the point was not to have to downlaod 2gigs of install files over the network. I am using the unc path example above to map a drive to my corp. install server where we keep all the apps we have to install. I dont want to have to download all the apps I install over the network just to install them.

With the unc path version I am able to add a shortcut to my Image and any machine that is imaged has a shortcut to WPI on our server, The desktop guys run the cmd to kick off the WPI and select thier programs and start. Way to fast and easy and I really wanted to thank everyone for all thier help.

Ben
thefastone
After a couple of years im saying hello again! welcome.gif
I must say the WPI community and special the developer have done a great job..!!! thumbup.gif

Im trying to run WPI from Winpe 2 wich is freeware if used from WAIK...

1. Winpe2 its running in Ram after deployment from PXE-Linux Server...
2. WPI is working fine if i run it from Ramdrive...also all aplications are running fine...if they also stay in RAM

My biggest problem is i dont have enough RAM.... (Its also easier to update all thinks in the network share!!!)

So im trying to run WPI and al the other stuff from network...and because its not working im now here.....
I cant make run WPI from network share: Because the Winpe2 User "System" dont knows Driveletters like z:
at other side i cant use the method running wpi from %share% because i must (beacuse of security settings in Winpe2???) start wpi.hta with x:\windows\system32\mshta.exe %share%\wpi.hta ...but this works only partially i get the errors shown in attached files: ..after the last error i see only a blank "mshta" window.

I think there is (in my case) some problem with the wpipath variable... maybe the variable is not interpreted correctly in Winpe2??

My Question: Is there somebody out there who has running the combination WINPE2 and WPI with apllications from Network share? unsure.gif

a lot of thanks for any answer!
JuMz
A Side Question:

Why are you running WPI in a Preinstallation Environment (PE)? What could you possibly install in an environment that is meant to install an operating system?
zorphnog
I believe he is installing tools/apps that cannot be integrated into the PE image.
thefastone
OK! You are making the right question!!! Why use WPI in preinstalation environment???

This same question i have made about 3 years before....well my question was: Why i cant select in an GUI in the first 5 minutes of contact with a n new PC all the components i want have installed onto the computer..????

WPI for me is more than
Windows (why not Linux)
Post (why not Pre...)
Instalation (why not other thinks like Virus Scan or Bios Update or Imaging with Imagex?? )

If i create some new scripts (like now unattend Application installs) i can make WPI most powerfull than ever!!!

Running from WInpe2 its possible to make in the first minute
  • rescue and antivirus operations on existent Installation of a PC
  • defining of wich operating system and applications will be installed (unattended WIndows script /unattended apllication scripts applied with imagex)
and and and...

ok all what in the year 2004 only was in my mind in this moment exists: File-based Imaging Solution!! and a powerfull GUI so that everbody can use it once configured... the end-user has only to know where to put the aplication and OS "source files"!!!

Ok ...the only problem is: How to make it work from a Network Ressource after booting also the Winpe2 from Network.... i hope the developers will take my comments as an suggestion for improvements newwink.gif

Oh, and i have made some improvements regarding slimming down Winpe2.. at this moment im using an only 80MB "small" WinPE2 winpe.wim wich is working fine (if wpi is installed in this file)...
thefastone
ok fine...no replies... sad.gif
well another question: Im getting "error on line102" (see my picture above) when i delete wbem folder... i think there is an unique WMI comannd elsewhere in scripts... who knows about it... i can close the error windows and everthing else works fine...

Please i need shortly some constructive feedback smile.gif
thefastone
ok..i found the place in the sourcecode...
in core.js line 102 is detected the OSLanguage...
i comment out some lines and hardcoded my language

// var OSProps = GetObject("winmgmts:").InstancesOf("Win32_OperatingSystem");

// Language ID in Dec
// sLang = new Enumerator(OSProps).item();
// Enum = sLang.OSLanguage;
// DtoH = DecToHex(Enum);
// while (DtoH.length<4)
DtoH = "300a";
zorphnog
You know you can add WMI support to WinPE 2.0 and you won't get these errors. I haven't tried using WPI in PE, but I do use several other hta's and just as a rule of thumb I always add scripting and wmi support. You can add them to your PE image by using the peimg tool.

i.e.
CODE
peimg /install=*scripting* <pathtoPEmount>\Windows
peimg /install=*wmi* <pathtoPEmount>\Windows
eickst
I simply have a runonce line to map my WPI share to the T:\, and then run T:\wpi.hta

All of my install paths have T:\ in them instead of %cdrom%, I haven't felt the need to go back and change them.

Hundreds of installs, no problems. (At least no problems when the file server is linux based).
big_orneau
i use this one :

CODE
@ECHO on

net use W: \\172.20.5.251\partage /PERSISTENT:NO
REM Set the variables for the sharename and the application directory
SET wpipath=WPI
SET drvlet=W:

REM Write the app-path to the regsitry
REG ADD HKLM\SOFTWARE\WPI /v SWPATH /t REG_EXPAND_SZ /d "%drvlet%" /f

REM Determine the WPI startup path.
SET wpipath=%drvlet%\%wpipath%

REM Font installation - the smooth and customizable way.
start "" /wait "%wpipath%\Tools\fonts\fontinstaller.exe"

REM Force resolution to needed size for wpi interface.
REM start "" /wait "%wpipath%\Tools\VideoChanger.exe 1024x768x32@85 -q"

REM Special registry tweak needed.
regedit /s "%wpipath%\common\wpi.reg"

REM Make WPI directory the current directory.
for /f "delims=: tokens=1" %%i in ("%wpipath%") do %%i:
cd "%wpipath%"

REM Start WPI and wait for its end
start /wait WPI.hta

REM Delete the Key out of the registry
REG DELETE HKLM\Software\WPI /f

endlocal&goto :eof
GrowBigTrees
I adapted AlBundy33's nice cmdfile on these points:
  • Laufwerk should no longer be changed to your localized "Drive" or whatever, as the script looks now for the ":" after the driveletter
  • you can use WPI parameters when calling the cmdfile, as in WPI.cmd "OFFICE" "12" "SERVERWPI" "SERVERUser" "User'sPassword"
  • disabled "Open File Security" Warning when running applications

CODE
@ECHO OFF
::V5 2008-04-14 - WPI.CMD: launch WPI.hta from network or local
::see http://www.msfn.org/board/lofiversion/index.php/t76693.html
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

SET WPICONFIG=
SET WPICOUNTDOWN=
SET SHARE=
SET USERNAME=
SET PASSWORD=
::to disable "Open File Security Warning" when running applications - see http://www.pcreview.co.uk/forums/thread-175517.php
SET SEE_MASK_NOZONECHECKS=1
:: or you can use this: (see http://www.msfn.org/board/lofiversion/index.php/t76693.html)
::    SET "KEYD=HKCU\Software\Microsoft\Internet Explorer\Download"
::    SET "KEYP=HKCU\Software\Microsoft\Windows\CurrentVersion\Policies"
::    REG add "%KEYD%" /v "CheckExeSignatures" /d "no" /f
::    REG add "%KEYD%" /v "RunInvalidSignatures" /t "REG_DWORD" /d 1 /f
::    REG add "%KEYP%\Attachments" /v "SaveZoneInformation" /t "REG_DWORD" /d 1 /f
::    REG add "%KEYP%\Associations" /v "LowRiskFileTypes" /d ".cmd;.exe;.hta;" /f

SET HIDEWINDOW=yes
IF NOT "%~1"=="" SET WPICONFIG=%~1&& echo parameter 1 = WPIconfig:            "!WPICONFIG!"
IF NOT "%~2"=="" SET WPICOUNTDOWN=%~2&& echo parameter 2 = WPICOUNTDOWN :            "!WPICOUNTDOWN!"
IF NOT "%~3"=="" SET SHARE=%~3&& echo parameter 3 = SHARE to install from:        "!SHARE!"
IF NOT "%~4"=="" SET USERNAME=%~4&& echo parameter 4 = USERNAME for mounting SHARE:    "!USERNAME!"
IF NOT "%~5"=="" SET PASSWORD=%~5&& = echo parameter 5 = PASSWORD for mounting SHARE:    "!PASSWORD!"
ECHO.

IF "%SHARE%"=="" (
    TITLE Running local WPI...
    echo Running local WPI from "%~dp0" ...
    PUSHD "%~dp0"
    CALL :RUN
    POPD
) ELSE (
    TITLE Running WPI from "!SHARE!"...
    IF NOT "!USERNAME!"=="" IF "!PASSWORD!"=="" SET /P PASSWORD=give PASSWORD for !USERNAME! @ !SHARE!:
    IF NOT "!PASSWORD!"=="" SET ARGUMENTS=!ARGUMENTS! "!PASSWORD!"
    IF NOT "!USERNAME!"=="" SET ARGUMENTS=!ARGUMENTS! /USER:"!USERNAME!"
    SET ARGUMENTS=!ARGUMENTS! /PERSISTENT:YES
    ::Look in the message when networkdrive mounted for the colon : after the localized Drive X: mounted or Laufwerk X: mounted or Station X: mounted :
    FOR /F "tokens=2" %%D IN ('NET USE * "!SHARE!" !ARGUMENTS!^|FINDSTR /I :') DO  SET DRIVELETTER=%%D
    IF "!DRIVELETTER!"=="" (
        PUSHD "!SHARE!"
        echo pushD the share "!SHARE!" because "!DRIVELETTER!" not found ...
    ) ELSE (
        PUSHD "!DRIVELETTER!"
    )
    ECHO.Running WPI from "!SHARE!" mounted to "!CD!"...
    CALL :RUN
    ECHO.Unmounting network-drive !CD!...
    POPD
    IF NOT "!DRIVELETTER!"=="" NET USE "!DRIVELETTER!" /DELETE /YES
)
GOTO :END

:RUN
    ECHO.Starting WPI...
    IF /I "%HIDEWINDOW%"=="yes" IF EXIST Tools\cmdow.exe Tools\cmdow.exe @ /HID
    START /wait "%WINDIR%\mshta.exe" wpi.hta %WPICONFIG% %WPICOUNTDOWN%
    GOTO :END

:END
Iskander Novena
Don't know if anybody still follows this thread or has alerts set or something..

You all use "NET USE * <SHARE> /USER:<user>" or "NET USE <SHARE> <DRIVELETTER> /USER:<user>" and do stuff to figure out what driveletter was used...

Did you know: when you use "NET USE <SHARE> /USER:<USER>" you don't get a drive-letter assigned for that UNC, but you CAN access it using the UNC-path?

So suppose I have a UNC which I have to have specific credentials for that's named \\Server\WPI.
I could easily connect to that in the following way:

NET USE \\Server\WPI /USER:install install
<do stuff>
NET USE \\Server\WPI /delete

This way, I connect to the UNC with user install and password install, do some stuff and then disconnect again....
mritter
@TheFastOne:

Avoid WMI error message

See if this helps any. I have not tested it myself.
SlonSoft
Please Give a run through the WPI http?
Sorry for my English
Google Internet Forums Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.