Map a drive and then install MSI with transform using a batch file - I know why not use VB
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 . . .
Answers (2)
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]".
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" PAUSE
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? - J.M. 10 years ago