This script will work if I remove the part that references the network folder. The code looks to me like it should work but it does nothing. No error. Nothing. What am I doing wrong?
Option Explicit
Dim file1, file2, fso, shell, objNetwork, curUser
set shell = createobject("wscript.shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("WScript.Network")
curUser = objNetwork.Username
file1 = "C:\\Temp\\done.txt"
file2 = "S:\\" & curUser & "\\done.txt"
msgbox file2
If fso.FileExists(file1) Then
msgbox "This file exists."
If fso.FileExists(file2) Then
msgbox "This files already exists on the S drive"
Else
MsgBox("The file does not exist. Install new client")
shell.run "chubbard.bat"
set file1 = fso.CreateTextFile("C:\\Temp\\done.txt")
set file2 = fso.CreateTextFile("S:\\" & curUser & "\\done.txt")
End if
End If
"\\Server\C$\"& curUser & "\\done.txt"
where c$ will be the hard drive that contain the Share resource for the Network that is mapped
Ex:
set file2 = fso.CreateTextFile("\\KDTe