troubleshooting Question

Referencing network folders in vbscript

Avatar of Glitterati2006
Glitterati2006 asked on
10 Comments1 Solution298 ViewsLast Modified:
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("")
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"
            MsgBox("The file does not exist.  Install new client")  
            set file1 = fso.CreateTextFile("C:\\Temp\\done.txt")
            set file2 = fso.CreateTextFile("S:\\" & curUser & "\\done.txt")
  End if
End If

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros