VBScript Permission Denied when copying files.
Posted on 2007-04-09
Need some help with this script. The script is below. I would like to use this script to copy 4 files from a server onto any host pc that I type in the input box. Files will copy to \\PCNAME\C$\Windows\System32.
I am getting 'Permission Denied'. I can copy it manually, so I know I do have access. Here is the script.
Dim input, strdestination, copyfiles, excopy, WshShell, sUser, sPass
sUser = "Domain\TESTUSER" 'this name has admin rights to directories
sPass = "PassWord"
Input = InputBox("Enter Name of Remote Computer")
strDestination ="\\" & Input & "\C$\Windows\System32"
set wshshell = CreateObject("Wscript.Shell")
WshShell.Run"runas /user:" & sUser & " " & CHR(34) & Input & CHR(34), 2, TRUE
Set EXCOPY = CreateObject("Scripting.FileSystemObject")
Set CopyFiles = EXCOPY.GetFile("L:\Wall_Street_Bull.jpg") 'will copy 4 files
Thanks in advance.