MSFN Forum: Tip for running WPI from network-share... - MSFN Forum

Jump to content



  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

Tip for running WPI from network-share... Rate Topic: -----

#1 User is offline   AlBundy33 

  • Member
  • PipPip
  • Group: Members
  • Posts: 217
  • Joined: 02-January 05

Posted 19 June 2006 - 07:33 AM

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.

@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


#2 User is offline   JuMz 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 466
  • Joined: 09-August 04

Posted 19 June 2006 - 09:10 AM

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


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

This post has been edited by JuMz: 19 June 2006 - 09:10 AM


#3 User is offline   AlBundy33 

  • Member
  • PipPip
  • Group: Members
  • Posts: 217
  • Joined: 02-January 05

Posted 19 June 2006 - 12:11 PM

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.
@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

#4 User is offline   Djé 

  • accent artist
  • PipPipPip
  • Group: Members
  • Posts: 359
  • Joined: 10-January 06

Posted 20 June 2006 - 08:38 AM

View PostAlBundy33, on Jun 19 2006, 08:11 PM, said:

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.
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:
NET USE Z: \\DJE\XPCD\install
and then in WPI, have your commands like:
Z:\myprog.exe -switch
But it may be less convenient than your method. Which I'm gonna investigate further right now. :thumbup


#5 User is offline   systemsmb 

  • Newbie
  • Group: Members
  • Posts: 28
  • Joined: 27-October 05

Posted 29 September 2006 - 03:16 AM

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

#6 User is offline   zorphnog 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 427
  • Joined: 25-July 06

Posted 29 September 2006 - 06:49 AM

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.

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

This post has been edited by zorphnog: 29 September 2006 - 06:52 AM


#7 User is offline   AlBundy33 

  • Member
  • PipPip
  • Group: Members
  • Posts: 217
  • Joined: 02-January 05

Posted 01 November 2006 - 06:27 PM

Just a modified version of my script:
@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

#8 User is offline   ty628659 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 10-October 04

  Posted 21 November 2006 - 11:43 AM

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: Would you please someone can help me :hello:


<< 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++;

...
...

This post has been edited by ty628659: 21 November 2006 - 11:44 AM


#9 User is offline   AlBundy33 

  • Member
  • PipPip
  • Group: Members
  • Posts: 217
  • Joined: 02-January 05

Posted 25 November 2006 - 07:07 PM

At first I would suggest to use %ROOT% instead of Z:
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

#10 User is offline   JuMz 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 466
  • Joined: 09-August 04

Posted 23 May 2007 - 01:36 PM

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...

This post has been edited by JuMz: 23 May 2007 - 01:37 PM


#11 User is offline   AlBundy33 

  • Member
  • PipPip
  • Group: Members
  • Posts: 217
  • Joined: 02-January 05

Posted 23 May 2007 - 02:09 PM

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
@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

This post has been edited by AlBundy33: 23 May 2007 - 02:15 PM


#12 User is offline   JuMz 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 466
  • Joined: 09-August 04

Posted 23 May 2007 - 02:13 PM

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?

This post has been edited by JuMz: 23 May 2007 - 02:13 PM


#13 User is offline   AlBundy33 

  • Member
  • PipPip
  • Group: Members
  • Posts: 217
  • Joined: 02-January 05

Posted 23 May 2007 - 02:22 PM

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

#14 User is offline   JuMz 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 466
  • Joined: 09-August 04

Posted 23 May 2007 - 02:26 PM

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!

This post has been edited by JuMz: 23 May 2007 - 02:26 PM


#15 User is offline   AlBundy33 

  • Member
  • PipPip
  • Group: Members
  • Posts: 217
  • Joined: 02-January 05

Posted 23 May 2007 - 02:41 PM

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

This is my output of net use * "!SHARE!"
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

#16 User is offline   AlBundy33 

  • Member
  • PipPip
  • Group: Members
  • Posts: 217
  • Joined: 02-January 05

Posted 23 May 2007 - 03:02 PM

Could you please try this script (but don't forget to change the FINDSTR-command).
@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


#17 User is offline   JuMz 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 466
  • Joined: 09-August 04

Posted 23 May 2007 - 03:40 PM

It worked perfectly! To the T! Nice work buddy!

#18 User is offline   AlBundy33 

  • Member
  • PipPip
  • Group: Members
  • Posts: 217
  • Joined: 02-January 05

Posted 23 May 2007 - 03:49 PM

Thanks.

#19 User is offline   AlBundy33 

  • Member
  • PipPip
  • Group: Members
  • Posts: 217
  • Joined: 02-January 05

Posted 13 June 2007 - 03:57 PM

New Version:
@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:
net use * \\home\system
Laufwerk Z: ist jetzt mit \\home\system verbunden.

Der Befehl wurde erfolgreich ausgeführt.


Greetings

Al

#20 User is offline   9h0s7 

  • Group: Members
  • Posts: 3
  • Joined: 12-September 07

Posted 12 September 2007 - 12: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.

Share this topic:


  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy