문제

I have a script that is meant to retrieve some files from a users old profile on a server and copy it to there new one, but the users do not have access rights for the folders/files in question when connecting through the server.

Is there a way passing a username/password with the following functions? Thanks.

objFSO.FolderExists(folder_path)
objFSO.CopyFolder(folder_path)
objFSO.CopyFile(folder_path)
도움이 되었습니까?

해결책

You have to map the share to a driveletter first, then

persistent = false
set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "driveletter:", "\\server\sharename", persistent, "username", "password"

Then use the normal filesystemobject to do the copying, using the driveletter or not. Once authenticated this way it's possible to do other operations with these credentials.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top