/build/static/layout/Breadcrumb_cap_w.png

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

 

 

 


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? - J.M. 9 years ago
  • It wants to try and run it from whatever network location I place it. - J.M. 9 years ago
  • 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? - J.M. 9 years ago
  • Type "CD /?" and you'll see this: "Use the /D switch to change current drive in addition to changing current directory for a drive." - vjaneczko 9 years ago
  • I envy you scriptingguys... :-) - J.M. 9 years ago

Answers (2)

Posted by: anonymous_9363 9 years ago
Red Belt
1

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


Comments:
  • 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 ? - J.M. 9 years ago
  • Got it figured out. thanks, I learned a lot this go round :-) - J.M. 9 years ago
Posted by: BHC-Austin 9 years ago
4th Degree Black Belt
1

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

 

 

 

 

 

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ