none
vbscript copy file to network share RRS feed

  • Question

  • Dear Exprt,

    its create folder by computername from computer where its run but file not coping not found

    Option Explicit
    Dim fso, f, objPC, CPY
       Set fso = CreateObject("Scripting.FileSystemObject")
    Set objPC = WScript.CreateObject( "WScript.Network" )
    Set CPY = CreateObject("Scripting.FileSystemObject")
    objPC = objPC.ComputerName
    Set f = fso.CreateFolder("\\sharefolder\log\Clientrepair\"&objPC)
    WScript.Sleep(5000)
     
    CPY.CopyFile "C:\Windows\System32\ccmsetup\ccmsetup.log", "\\sharefolder\log\Clientrepair\""objPC\", True


    Support@Mytechnet.me

    Wednesday, March 12, 2014 3:15 PM

Answers

  • Is that actual script you are running?

    If so, the CopyFile method is using incorrect syntax. It looks like it should be:


    CPY.CopyFile "C:\Windows\System32\ccmsetup\ccmsetup.log", "\\sharefolder\log\Clientrepair\" & objPC & "\", True
    


    -- Bill Stewart [Bill_Stewart]

    Wednesday, March 12, 2014 3:18 PM
    Moderator

All replies

  • Is that actual script you are running?

    If so, the CopyFile method is using incorrect syntax. It looks like it should be:


    CPY.CopyFile "C:\Windows\System32\ccmsetup\ccmsetup.log", "\\sharefolder\log\Clientrepair\" & objPC & "\", True
    


    -- Bill Stewart [Bill_Stewart]

    Wednesday, March 12, 2014 3:18 PM
    Moderator
  • Thanks it worked.

    i have same with folder i followed but same message


    Support@Mytechnet.me

    Wednesday, March 12, 2014 3:58 PM
  • What message? You will have to copy and paste the exact error message you're getting. Remember, we can't see your screen.

    Bill


    -- Bill Stewart [Bill_Stewart]

    Wednesday, March 12, 2014 4:18 PM
    Moderator
  • Path not found

    CPY.CopyFolder "C:\Windows\System32\CCM\Logs\", "\\sharefolder\log\Clientrepair\" & objPC & "\"


    Support@Mytechnet.me


    Wednesday, March 12, 2014 4:52 PM
  • That error message means that the script can't find the file you're trying to copy.


    -- Bill Stewart [Bill_Stewart]

    Wednesday, March 12, 2014 5:09 PM
    Moderator