Pass a username/password when accessing a folder via VBScript

后端 未结 1 1872
南方客
南方客 2021-01-26 23:33

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/f

相关标签:
1条回答
  • 2021-01-26 23:36

    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.

    0 讨论(0)
提交回复
热议问题