I'm trying to have a deployed script write to a file and log what it did. If I double click the file and run it it writes the file to the network share, but when I run it with a lansweeper deployment nothing happens. I've tested the script and it is going into the function. I've also gone into the network share and given full permissions to Everyone, and tried running as System Account/Scanning Credentials/Currently Logged On.
Not sure what I'm doing wrong. I can change the write location to the C: drive and it will write so it must be something to do with it being on a network share.
Not much to the script but here's the function in question.
Function WriteFileText(folder, state)
Dim fso, MyFile
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.OpenTextFile(logFile, ForAppending, True)
MyFile.WriteLine folder.DateLastModified & "," & state & "," & folder ' Write to the file.
MyFile.Close
End Function