'VBS RUNAS SCRIPT SAVE IT AS RUNAS_REMOTE_FILE_CHECK.VBS
strUser = "USER_NAME"
strDomain = "DOMAIN_NAME"
strCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
strRunAs ="runas /savecred /user:" & strDomain & "\" & strUser&" " & Chr(34)& "cscript.exe \"& Chr(34)& strCurPath & "\REMOTE_FILE_CHECK.VBS" & Chr(34)
Set WshShell = CreateObject("WScript.Shell")
strRunPath = strRunAs
WshShell.Run (strRunPath)
'========================================================================================================
'VBS SCRIPT - SAVE IT AS REMOTE_FILE_CHECK.VBS
strFilePath = "PATH FOR THE FILE"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strFilePath) Then
Wscript.Echo "File does exist."
Else
Wscript.Echo "File does NOT exist."
End If
|