/build/static/layout/Breadcrumb_cap_w.png

vbscript via SCCM

guys i am running a copy command vbscript via SCCM & it's not working. I get the successfull on the deployment but actually it's not copying the file. Please look @ the code that i am trying to execute. SCript works fine manually


Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.CopyFile "abc.js", "C:\Program Files\Mozilla Firefox\", true

0 Comments   [ + ] Show comments

Answers (6)

Posted by: pjgeutjens 13 years ago
Red Belt
2

Dim sCurPaths
CurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
should help you if you prepend this to your copy's source location
Posted by: Helpy 13 years ago
Senior Yellow Belt
0
That snipet of code may not be telling the whole story. What is the source location you are copying the file(s) from? The source of the file is just as important as the destination.
Posted by: chichora123 13 years ago
Fourth Degree Green Belt
0
running it from "system32\ccm\cache\100000.A"
Posted by: chichora123 13 years ago
Fourth Degree Green Belt
0
I can't tell the source path because it's different for every user. SCCM creates a directory structure under systems/cache folder & the folder name is different everytime you push the package, can't hard code path in my script.
Posted by: itolutions 13 years ago
Purple Belt
0
As i understand abc.js and your runnnng script located in the same folder
In this case you can try:



Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
srcFile = FSO.GetFile(Wscript.ScriptFullName).ParentFolder & "\abc.js"
FSO.CopyFile srcFile, "C:\Program Files\Mozilla Firefox\", true

Posted by: anonymous_9363 13 years ago
Red Belt
-1
I see we have another scripter who imagines that the scriptingengine can work out for itself where source the file is located. TryFSO.CopyFile "[path_containing_abc.js]abc.js", "C:\Program Files\Mozilla Firefox\", trueOh, and some error-trapping is always good. Like, does the source file exist? What about the target drive? The target path? In time, you'll create your own FileCopy function which has these things built in and you can then stop re-writing it every time you create a script.

Comments:
  • I like your little "attempting to give a Darn" etc... made me laugh - J.M. 10 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
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