Hi All,
Suppose I have a VBS file named Tester.vbs. Contents below:
Set objShell = CreateObject("Wscript.Shell")
objSHell.Run("""S:\Photos Folder\User ABC\Face Photos""")
This script runs fine and opens the folder.
Now, I want to open that specific folder (It's a network folder and the script STRICTLY has to use the mapped drive letter of S:--NO absolute path allowed) as user useradmin (password: password1)
I use the following script (RunAs.vbs) in the same folder:
Dim strCreateFolder
strCreateFolder = "Tester.vbs"
set WshShell = CreateObject("WScript.Shell")
strCmdLine = "runas /netonly /noprofile /userOMAIN123\useradmin" & _
" ""cmd.exe /c wscript " & "\""" & strCreateFolder & "\""" & """"
WshShell.Run strCmdLine, 2, False
WScript.Sleep 100
WshShell.Sendkeys "password1~"
User useradmin has permissions to that folder S:\Photos Folder\User ABC\Face Photos
I think I've exhausted all possible troubleshooting measures (e.g. changing the 3 quotes to 2 quotes to 1 quote, put absolute locations of the file, etc.). Nothing seems to work.
Bottom line is: I need to open a network folder (using the mapped drive letter) as a different user. PLEASE HELP.