Jump to content

Tip for running WPI from network-share...


Recommended Posts

i use this one :

@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

Link to comment
Share on other sites

  • 5 months later...

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

@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

Edited by GrowBigTrees
Link to comment
Share on other sites

  • 3 months later...

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

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

I am by NO MEANS a good coder. In fact I'd go as far as to say I suck. But I absolutely love AutoIT, as it is extremely powerful, and I decided to write a version of this script in it.

This is what works for me. Feel free to add/change things as you guys see fit, and clean it up some if you'd like. It actually works quite a bit faster than the cmd file. Please note my comments, especially the ones at the top of the script.

Just copy and paste the code into SciTE and compile it once you're done editing.

;This script can run either one folder up from WPI.hta directly from the share itself or from another location if you specify the share.
;The directory structure must be like this: SomePath\SomeFolder\WPI\ where WPI.hta is in the WPI folder and this script is either in SomeFolder OR
;a share is specified with SomeFolder shared (as in, the share path would look like \\server\share\WPI with WPI.hta in the WPI folder)

AutoItSetOption("TrayIconHide",1)

;Change these values to suit your needs. You can also get rid of the If/ElseIf statements in the CallWPI function if you just use one config.
Global $CONFIG1="CONFIGXP.JS"
Global $CONFIG2="CONFIGVISTA.JS"
Global $USERNAME=""
Global $PASSWORD=""
Global $SHARE=""

;Global variables needed for the rest of the program... DON'T CHANGE THESE VALUES.
Global $IEDebWritten=false
Global $DebWritten=false
Global $DRIVE=""

EnvSet("SEE_MASK_NOZONECHECKS",1)

SetDrive()
SetDebugger()
CallWPI()
ResetDebugger()
UnmapDrive()

EnvSet("SEE_MASK_NOZONECHECKS")

Exit

Func SetDrive()
$trimmedpath=StringTrimRight(@ScriptDir,StringLen(@ScriptDir)-2)

If StringLen($SHARE)=0 Then
If $trimmedpath="\\" and $USERNAME="" Then
$DRIVE=DriveMapAdd("*",@ScriptDir,8)
ElseIf $trimmedpath="\\" and StringLen($USERNAME)>0 Then
$DRIVE=DriveMapAdd("*",@ScriptDir,8,$USERNAME,$PASSWORD)
ElseIf FileExists($trimmedpath & "\WPI.exe") Then
$DRIVE=$trimmedpath
Else
$DRIVE=@ScriptDir
EndIf
ElseIf StringLen($SHARE)>0 and $USERNAME="" Then
$DRIVE=DriveMapAdd("*",$SHARE,8)
ElseIf StringLen($SHARE)>0 and StringLen($USERNAME)>0 Then
$DRIVE=DriveMapAdd("*",$SHARE,8,$USERNAME,$PASSWORD)
EndIf
EndFunc

Func SetDebugger()
$IEDebValue=RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "DisableScriptDebuggerIE")

If $IEDebValue="yes" Then
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "DisableScriptDebuggerIE", "REG_SZ", "no")
$IEDebWritten=true
ElseIf @error Then
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "DisableScriptDebuggerIE", "REG_SZ", "no")
EndIf

$DebValue=RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Disable Script Debugger")

If $DebValue="yes" Then
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Disable Script Debugger", "REG_SZ", "no")
$DebWritten=true
ElseIf @error Then
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Disable Script Debugger", "REG_SZ", "no")
EndIf
EndFunc

Func CallWPI()
If @OSVersion<>"WIN_Vista" Then
RunWait(@SystemDir & "\mshta.exe " & '"' & $DRIVE & "\WPI\WPI.hta" & '"' & " config=" & '"' & $DRIVE & "\WPI\WPIScripts\" & $CONFIG1 & '"',"")
ElseIf @OSVersion="WIN_Vista" Then
RunWait(@SystemDir & "\mshta.exe " & '"' & $DRIVE & "\WPI\WPI.hta" & '"' & " config=" & '"' & $DRIVE & "\WPI\WPIScripts\" & $CONFIG2 & '"',"")
EndIf
EndFunc

Func ResetDebugger()
If $IEDebWritten=true Then
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "DisableScriptDebuggerIE", "REG_SZ", "yes")
EndIf

If $DebWritten=true Then
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Disable Script Debugger", "REG_SZ", "yes")
EndIf
EndFunc

Func UnmapDrive()
If DriveMapGet($DRIVE)=@ScriptDir or DriveMapGet($DRIVE)=$SHARE Then
DriveMapDel($DRIVE)
EndIf
EndFunc

Edited by chaoticyeshua
Link to comment
Share on other sites

  • 6 months later...

I hope someone can help with the issue I'm currently having with my network WPI repository. I've been running up to version 7.3 of WPI from my network source without issue. I recently upgraded to 7.5 and I'm having the following problem.

My UI runs a batch file that inserts a run once regkey to execute a cmd file (from this topic) to launch WPI at next login. The cmd executes and the WPI window appears briefly then disappears. Once the desktop loads, I'm able to launch the cmd file again and WPI loads and runs without issue. My cmd file has not changed in over a year, but the jump from 7.3 to 7.5 seems to bring this issue with it.

Any help would be greatly appreciated.

Link to comment
Share on other sites

It probably has to do with the Office reg key issue. Search for that thread for details.

I have made this an option in 7.6.0, which will be released July 1st. It should fix your problem.

Link to comment
Share on other sites

  • 1 year later...

Hello all,

I try to Install Windows 7 Prof. via DVD and want to get WPI Installation over Network

I added and modified "setupcomplete.cmd" to "sources\$oem$\$$\setup\scripts" on the Windows 7 DVD.

Windows installs fine, then it comes the first start - "preparing for first use" and "checking video performance" and then it freeze.

here is my "setupcomplete.cmd":


reg add "HKLM\System\CurrentControlSet\Control\Network\NetworkLocationWizard" /v HideWizard /t REG_DWORD /d 00000001 /f

net use Z: \\192.168.x.xxx\DEPLOY

Start z:\WPI\wpi.exe

I tried also to connect via Net Use with Username and Password, but no change - same freeze.

When i run WPI from DVD with the following "setupcomlete.cmd" it works fine.


for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\sources\install.wim set CDROM=%%i:

reg add "HKLM\System\CurrentControlSet\Control\Network\NetworkLocationWizard" /v HideWizard /t REG_DWORD /d 00000001 /f

Start %cdrom%\WPI\wpi.exe

del %0

Thanks for your help

Edited by djbazo
Link to comment
Share on other sites

Maybe your network is not setup correctly?

you can try this:


REM reg add "HKLM\System\CurrentControlSet\Control\Network\NetworkLocationWizard" /v HideWizard /t REG_DWORD /d 00000001 /f

REM create automatically a networkdrive (works only if the share is not password-protected)
PUSHD \\192.168.x.xxx\DEPLOY

REM Start WPI and wait until it was closed
Start "running WPI..." /Wait WPI\wpi.exe

REM removes the networkdrive
POPD

Attention: If WPI restarts your PC the network-drive is lost.

Al

Link to comment
Share on other sites

Hi Al,

thanks for your reply - i tried it with your syntax but it doesnt work - still the same issue

Windows installs fine, then it comes the first start - "preparing for first use" and "checking video performance" and then it freeze.

after i step over with ALT + F4 windows loads but it seems that setupcomplete.cmd doesnt run.

Link to comment
Share on other sites

Hey Al,

I solved it with the following config:

setupcomplete.cmd

for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\sources\install.wim set CDROM=%%i:

copy %cdrom%\WPI\WPIRUN.cmd "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup" /Y

del %0

WPIRUN.cmd

for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\sources\install.wim set CDROM=%%i:

REG add "HKCU\Software\Microsoft\Internet Explorer\Download" /v "CheckExeSignatures" /d "no" /f
REG add "HKCU\Software\Microsoft\Internet Explorer\Download" /v "RunInvalidSignatures" /t "REG_DWORD" /d 1 /f
REG add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments" /v "SaveZoneInformation" /t "REG_DWORD" /d 1 /f
REG add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Associations" /v "LowRiskFileTypes" /d ".cmd;.exe;.hta;" /f
reg import %cdrom%\wpi\software\Tools\NetzwerkinstallationEXE.reg
regedit /s %cdrom%\wpi\software\Tools\NetzwerkinstallationEXE.reg


REM create automatically a networkdrive (works only if the share is not password-protected)
PUSHD \\192.168.x.xxx\DEPLOY

REM Start WPI and wait until it was closed
Start "running WPI..." /Wait WPI\wpi.exe

REM removes the networkdrive
POPD

NetzwerkinstallationEXE.reg

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Associations]
"LowRiskFileTypes"=".exe;.cab;.msi;.msu;.cmd;.vbs"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Attachments]
"SaveZoneInformation"=dword:1

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Download]
"CheckExeSignatures"="no"
"RunInvalidSignatures"=dword:1

thanks!

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