Jump to content


Recommended Posts

Hi Everyone,

 

Just installed SCCM, have a management server, and 3 three DP's in different sites which link via AD sites. My problem is related to software installation within a Task Sequence.

 

Question: When running "Run Command Line" with a linked package via TS; I am not downloading the package file to the client, so how do I copy files from the package to the client if I do not know what the source path is? Reading on the net I could run a VBScript to learn the path that the package is running from:

 

'Set Current Script Directory
strCurrentDir = Left(Wscript.ScriptFullName,(InstrRev(Wscript.ScriptFullName, "\") -1))

 

I have also played with %~dp0, but no sucess. The same applies if I run a batch file within a program linked to a software install.

 

But is there any other way, I have no problems if the package just uses a simple MSI file but on some installations I need to copy files.

 

Sorry I am just going round in circles and getting nowhere.

 

Thanks

 

Richard

Share this post


Link to post
Share on other sites

Is it only about copying files from a package to a location on the local machine?

 

If yes, then create a Run Command Line -step, select your package and use a "xcopy * <destination>" -command.

 

Thanks for the reply. I have tried that but because the working directory cannot be set to the DP package folder due to unc paths, I have to specify a source path.

 

The following works for me, but will only work when I run from a batch file within the Command line task.

copy "%0\..\Common\*.*" "C:\Documents and Settings\All Users\Application Data\McKessonSTAR\Common\" /Y

 

I have tried the line below directly within the command line task but nothing copies.

cmd.exe /c copy "%0\..\Common\*.*" "C:\Documents and Settings\All Users\Application Data\McKessonSTAR\Common\" /Y

 

<![LOG[updated security on object C:\_SMSTaskSequence.]LOG]!><time="14:34:13.884+-60" date="05-29-2010" component="TSManager" context="" type="1" thread="3452" file="utils.cpp:829">
<![LOG[set a global environment variable _SMSTSNextInstructionPointer=2]LOG]!><time="14:34:13.884+-60" date="05-29-2010" component="TSManager" context="" type="0" thread="3452" file="executionenv.cxx:668">
<![LOG[set a TS execution environment variable _SMSTSNextInstructionPointer=2]LOG]!><time="14:34:13.884+-60" date="05-29-2010" component="TSManager" context="" type="0" thread="3452" file="executionenv.cxx:386">
<![LOG[set a global environment variable _SMSTSInstructionStackString=0 1]LOG]!><time="14:34:13.884+-60" date="05-29-2010" component="TSManager" context="" type="0" thread="3452" file="executionenv.cxx:668">
<![LOG[set a TS execution environment variable _SMSTSInstructionStackString=0 1]LOG]!><time="14:34:13.884+-60" date="05-29-2010" component="TSManager" context="" type="0" thread="3452" file="executionenv.cxx:414">
<![LOG[save the current environment block]LOG]!><time="14:34:13.884+-60" date="05-29-2010" component="TSManager" context="" type="0" thread="3452" file="executionenv.cxx:833">
<![LOG[start executing an instruciton. Instruction name: Run Command Line. Instruction pointer: 2]LOG]!><time="14:34:13.900+-60" date="05-29-2010" component="TSManager" context="" type="1" thread="3452" file="engine.cxx:117">
<![LOG[set a global environment variable _SMSTSCurrentActionName=Run Command Line]LOG]!><time="14:34:13.900+-60" date="05-29-2010" component="TSManager" context="" type="0" thread="3452" file="executionenv.cxx:668">
<![LOG[set a global environment variable _SMSTSNextInstructionPointer=2]LOG]!><time="14:34:13.900+-60" date="05-29-2010" component="TSManager" context="" type="0" thread="3452" file="executionenv.cxx:668">
<![LOG[set a local default variable SMSTSDisableWow64Redirection]LOG]!><time="14:34:13.900+-60" date="05-29-2010" component="TSManager" context="" type="0" thread="3452" file="executionenv.cxx:700">
<![LOG[set a local default variable _SMSTSRunCommandLineAsUser]LOG]!><time="14:34:13.900+-60" date="05-29-2010" component="TSManager" context="" type="0" thread="3452" file="executionenv.cxx:700">
<![LOG[set a global environment variable _SMSTSLogPath=C:\WINDOWS\system32\CCM\Logs\SMSTSLog]LOG]!><time="14:34:13.900+-60" date="05-29-2010" component="TSManager" context="" type="0" thread="3452" file="executionenv.cxx:668">
<![LOG[Expand a string: smsswd.exe /run:SLH00045 cmd.exe /c copy "%0\..\Common\*.*" "C:\Documents and Settings\All Users\Application Data\McKessonSTAR\Common\" /Y]LOG]!><time="14:34:13.900+-60" date="05-29-2010" component="TSManager" context="" type="0" thread="3452" file="executionenv.cxx:782">
<![LOG[Expand a string: ]LOG]!><time="14:34:13.900+-60" date="05-29-2010" component="TSManager" context="" type="0" thread="3452" file="executionenv.cxx:782">
<![LOG[start executing the command line: smsswd.exe /run:SLH00045 cmd.exe /c copy "%0\..\Common\*.*" "C:\Documents and Settings\All Users\Application Data\McKessonSTAR\Common\" /Y]LOG]!><time="14:34:13.900+-60" date="05-29-2010" component="TSManager" context="" type="1" thread="3452" file="instruction.cxx:2928">
<![LOG[!--------------------------------------------------------------------------------------------!]LOG]!><time="14:34:13.900+-60" date="05-29-2010" component="TSManager" context="" type="1" thread="3452" file="instruction.cxx:2957">
<![LOG[Expand a string: WinPEandFullOS]LOG]!><time="14:34:13.900+-60" date="05-29-2010" component="TSManager" context="" type="0" thread="3452" file="executionenv.cxx:782">
<![LOG[Executing command line: smsswd.exe /run:SLH00045 cmd.exe /c copy "%0\..\Common\*.*" "C:\Documents and Settings\All Users\Application Data\McKessonSTAR\Common\" /Y]LOG]!><time="14:34:13.900+-60" date="05-29-2010" component="TSManager" context="" type="1" thread="3452" file="commandline.cpp:805">
<![LOG[=======================[ smsswd.exe ] =======================]LOG]!><time="14:34:13.915+-60" date="05-29-2010" component="InstallSoftware" context="" type="1" thread="2416" file="main.cpp:303">
<![LOG[PackageID = 'SLH00045']LOG]!><time="14:34:13.931+-60" date="05-29-2010" component="InstallSoftware" context="" type="1" thread="2416" file="main.cpp:332">
<![LOG[baseVar   = '', ContinueOnError='']LOG]!><time="14:34:13.931+-60" date="05-29-2010" component="InstallSoftware" context="" type="1" thread="2416" file="main.cpp:333">
<![LOG[swdAction = '0001']LOG]!><time="14:34:13.931+-60" date="05-29-2010" component="InstallSoftware" context="" type="1" thread="2416" file="main.cpp:334">
<![LOG[successfully connected to "\\QE-SCMAN01.SLHT.SLH.NHS.UK\SMSPKGF$\SLH00045"]LOG]!><time="14:34:13.946+-60" date="05-29-2010" component="InstallSoftware" context="" type="1" thread="2416" file="tsconnection.cpp:287">
<![LOG[Resolved source to '\\QE-SCMAN01.SLHT.SLH.NHS.UK\SMSPKGF$\SLH00045']LOG]!><time="14:34:13.946+-60" date="05-29-2010" component="InstallSoftware" context="" type="1" thread="2416" file="runcommandline.cpp:449">
<![LOG[Working dir '\\QE-SCMAN01.SLHT.SLH.NHS.UK\SMSPKGF$\SLH00045']LOG]!><time="14:34:13.946+-60" date="05-29-2010" component="InstallSoftware" context="" type="1" thread="2416" file="runcommandline.cpp:542">
<![LOG[Executing command line: Run command line]LOG]!><time="14:34:13.946+-60" date="05-29-2010" component="InstallSoftware" context="" type="1" thread="2416" file="commandline.cpp:805">
<![LOG[Process completed with exit code 1]LOG]!><time="14:34:13.993+-60" date="05-29-2010" component="InstallSoftware" context="" type="1" thread="2416" file="commandline.cpp:1102">
<![LOG[The system cannot find the path specified.]LOG]!><time="14:34:13.993+-60" date="05-29-2010" component="InstallSoftware" context="" type="1" thread="2416" file="runcommandline.cpp:34">
<![LOG['\\QE-SCMAN01.SLHT.SLH.NHS.UK\SMSPKGF$\SLH00045']LOG]!><time="14:34:13.993+-60" date="05-29-2010" component="InstallSoftware" context="" type="3" thread="2416" file="runcommandline.cpp:40">
<![LOG[CMD.EXE was started with the above path as the current directory.]LOG]!><time="14:34:13.993+-60" date="05-29-2010" component="InstallSoftware" context="" type="3" thread="2416" file="runcommandline.cpp:40">
<![LOG[uNC paths are not supported.  Defaulting to Windows directory.]LOG]!><time="14:34:13.993+-60" date="05-29-2010" component="InstallSoftware" context="" type="3" thread="2416" file="runcommandline.cpp:40">
<![LOG[Command line returned 1]LOG]!><time="14:34:13.993+-60" date="05-29-2010" component="InstallSoftware" context="" type="1" thread="2416" file="runcommandline.cpp:565">
<![LOG[Process completed with exit code 1]LOG]!><time="14:34:13.993+-60" date="05-29-2010" component="TSManager" context="" type="1" thread="3452" file="commandline.cpp:1102">
<![LOG[!--------------------------------------------------------------------------------------------!]LOG]!><time="14:34:13.993+-60" date="05-29-2010" component="TSManager" context="" type="1" thread="3452" file="instruction.cxx:3010">
<![LOG[Failed to run the action: Run Command Line. 
Incorrect function. (Error: 00000001; Source: Windows)]LOG]!><time="14:34:13.993+-60" date="05-29-2010" component="TSManager" context="" type="3" thread="3452" file="instruction.cxx:3101">

Share this post


Link to post
Share on other sites

put this in front of the command %~dp0. it will add the unc location for you :)

 

For example if you have to run a test.exe from a cmd line and want to use UNC you can type %~dp0test.exe and it will call it \\QE-SCMAN01.SLHT.SLH.NHS.UK\SMSPKGF$\SLH00045\test.exe taking from your logs

 

This way it works very well with multiple DP as it will change the current location for you ;)

Share this post


Link to post
Share on other sites

put this in front of the command %~dp0. it will add the unc location for you :)

 

For example if you have to run a test.exe from a cmd line and want to use UNC you can type %~dp0test.exe and it will call it \\QE-SCMAN01.SLHT.SLH.NHS.UK\SMSPKGF$\SLH00045\test.exe taking from your logs

 

This way it works very well with multiple DP as it will change the current location for you ;)

 

I will give that a go, if I can't get it working I will just use a batch file if I need to run a command Line task.

 

Thanks

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...