I am trying to build a little script to assit me in the few one offs I cannot hit via SCCM while depolying Java.  I have a handfull of boxes that SCCM says are sucessfull but they are not, so I go to the users desk and fix it by hand.. no biggie. I am not a scripting guy, I don'y know VB and am struggling with a simple batch file.  It maps the drive but will not go to the mapped drive to execute it wants to revert to my user profile.  Moving it to any other network location has it trying to run from there as opposed to the mapped drive called for in the .bat file

Batch file

:: run java from CMD line for one offs

ECHO Begin Mapping Drives
net use G: "\\pgsmsxxxx\share share\JAVA\JAVA 7U55" /PERSISTENT:NO G: MSIEXEC /I "%~dp0jre1.7.0_55.msi"  TRANSFORMS="Java7u55.mst"  /log "C:\Setup_Java.log"

my output is

H:\>ECHO Begin Mapping Drives
Begin Mapping Drives H:\>net use G: "\\pgsmsxxxx\share share\ source\JAVA\JAVA 7U55" /PERSISTENT:NO
The command completed successfully.
H:\>cd G:
G:\ H:\>G: MSIEXEC /I "H:\jre1.7.0_55.msi"  TRANSFORMS="Java7u55.mst"  /log "C:\Setu
p_Java.log" G:\>Pause
Press any key to continue . . .




5 Comments   [ + ] Show Comments


  • Sorry about all th etypo's did not proof :-(
    I moved the batch file off my desk top and that resolved that problem so I'll park it on the network when I am ready but the install line does not run from the bat file but does run if I run it from the cmd line, so I have a syntax error?
  • It wants to try and run it from whatever network location I place it.
  • BHC-Austin... Thanks I have a winner... what is happening here at the CD leval CD /D G:\ I am unsure of the /D switch?
  • Type "CD /?" and you'll see this: "Use the /D switch to change current drive in addition to changing current directory for a drive."
  • I envy you scriptingguys... :-)
Please log in to comment



SCCM uses the machine's System account to do its work. By default, that account has no network access.

Change your delivery to copy the source locally and run it from there. You won't require a mapped drive, then.

FFR, I would change your log argument to be verbose: the default setting tells you next to nothing. So, not "/log [whatever]" but "/l*v [whatever]".

Answered 06/05/2014 by: VBScab
Red Belt

  • OK showing my ignorance. I looked up /l*v on technet and I get that, but where does it write the log file to? does [whatever] become my C:\Setup_Java ?
  • Got it figured out. thanks, I learned a lot this go round :-)
Please log in to comment

It's trying to run from whatever location you place the batch file because you are using the %~dp0. That does not equate to current directory, but location of the batch file.

Try something like this:


NET USE G: "\\pgsmsxxxx\share share\ source\JAVA\JAVA 7U55" /PERSISTENT:NO

CD /D G:\

MSIEXEC /I "jre1.7.9_55.msi" TRANSFORMS="Java7u55.mst" /log "C:\Setup_Java.log"







Answered 06/03/2014 by: BHC-Austin
Fourth Degree Black Belt

Please log in to comment
Answer this question or Comment on this question for clarity