VBSCript and %userprofile% - File NOt found

I am try to write a script that will drop a log file at the root of the user's profile using %userprofile%

I searched online on how to do this but still no luck.

 What is the proper syntax I need to reference %userprofile% and drop a file with a predefined name in this location.
LVL 20
compdigit44Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MacroShadowCommented:
Not sure what you mean by "drop a file". This will give you the user profile folder:
Set ws = WScript.CreateObject("WScript.Shell")
strUserProfile = ws.ExpandEnvironmentStrings("%userprofile%")

Open in new window

0
compdigit44Author Commented:
I mean the log file created has to be placed in the %userprofile% directory.

When I call the file in the script using strprofile\file.txt I get file not found
0
MacroShadowCommented:
Do you want to copy the log file or move it? What is the source path?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

compdigit44Author Commented:
I need to create a new log file in this location
0
MacroShadowCommented:
Try this:
Dim oWsh, strUserProfile , oFSO, oFile

Set oWsh = WScript.CreateObject("WScript.Shell")
strUserProfile = ws.ExpandEnvironmentStrings("%userprofile%")
Set oFSO= CreateObject("Scripting.FileSystemObject")
Set oFile= oFSO.CreateTextFile("strUserProfile\file.txt")

Open in new window

0
compdigit44Author Commented:
I get the error in line one:  "object required: 'ws'
0
MacroShadowCommented:
Use the new code instead of the old one.
0
compdigit44Author Commented:
I am it errors on line 4

strUserProfile = ws.ExpandEnvironmentStrings("%userprofile%")

Object required 'WS'
0
MacroShadowCommented:
I'm so sorry, should be:
strUserProfile = oWsh.ExpandEnvironmentStrings("%userprofile%")

Open in new window

0
compdigit44Author Commented:
Thanks!!!

I we are makin progess.. I keep getting path not found though.

Here is my line to insert the log file...

Set objLogFile = objFSO.OpenTextFile("oFile", 8, True, 0)
0
MacroShadowCommented:
Now I'm confused, the code I posted creates a text file (file.txt) in the user profile. Isn't that what you want?
0
compdigit44Author Commented:
No I think  I am confused since  I not not a scripting person. Below is sample from my scirpt so far...
Dim oWsh, strUserProfile , oFSO, oFile

Set oWsh = WScript.CreateObject("WScript.Shell")
strUserProfile = oWsh.ExpandEnvironmentStrings("%userprofile%")
Set oFSO= CreateObject("Scripting.FileSystemObject")
Set oFile= oFSO.CreateTextFile("strUserProfile\file.txt")



Function LogEntry (LogEntryText)
      objLogFile.WriteLine "<![LOG[" & LogEntryText & "]LOG]!><time=""" & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now) & ".001+240"" date=""" & Replace(Date(), "/", "-") & """ component=""PrintMapDelete"" context="""" type=""1"" thread=""0"" file=""" & WScript.Application & " " & WScript.Version & """>"
End Function
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objLogFile = objFSO.OpenTextFile(oFile, 8, True, 0)

Why is my Set objLogFile = objFSO.OpenTextFile(oFile, 8, True, 0) line not working
0
compdigit44Author Commented:
What is going wrong ??????
0
MacroShadowCommented:
Try this:
Dim oWsh, strUserProfile, oFSO, oFile

Call LogEntry("TEST")

Function LogEntry(LogEntryText)
    Set oWsh = WScript.CreateObject("WScript.Shell")
    strUserProfile = oWsh.ExpandEnvironmentStrings("%userprofile%")
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    Set oFile = oFSO.OpenTextFile(strUserProfile & "\file.txt", 8, True, 0)
    oFile.WriteLine "<![LOG[" & LogEntryText & "]LOG]!><time=""" & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now) & ".001+240"" date=""" & Replace(Date, "/", "-") & """ component=""PrintMapDelete"" context="""" type=""1"" thread=""0"" file=""" & WScript.Application & " " & WScript.Version & """>"
End Function

Open in new window

0
compdigit44Author Commented:
Still having problems ...

Below is a sample of my script.

Dim oWsh, strUserProfile, oFSO, oFile

Call LogEntry("LogEntryText")

Function LogEntry(LogEntryText)
    Set oWsh = WScript.CreateObject("WScript.Shell")
    strUserProfile = oWsh.ExpandEnvironmentStrings("%userprofile%")
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    Set oFile = oFSO.CreateTextFile(strUserProfile & "\file.txt")
    Set oFile = oFSO.OpenTextFile(strUserProfile & "\file.txt", 8, 0)
    oFile.WriteLine "<![LOG[" & LogEntryText & "]LOG]!><time=""" & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now) & ".001+240"" date=""" & Replace(Date, "/", "-") & """ component=""PrintMapDelete"" context="""" type=""1"" thread=""0"" file="""    '& WScript.Application & " " & WScript.Version & """>"
End Function



Set WshNetwork = WScript.CreateObject("WScript.Network")
Set colPrinters = WshNetwork.EnumPrinterConnections
For intPrinter = 0 To colPrinters.Count - 1 Step 2
      strPrinterPort = colPrinters(intPrinter)
      strPrinterName = colPrinters(intPrinter + 1)
      LogEntry strPrinterName & " - " & strPrinterPort

      If left(colPrinters.Item(intPrinter + 1),len(strSrvName1)) = strSrvName1 Then
            LogEntry "      Printer matches target name.  Printer will be deleted"
            On Error Resume Next
            WshNetwork.RemovePrinterConnection strPrinterName
0
MacroShadowCommented:
What is the problem and where does it occur?
0
compdigit44Author Commented:
line 10 char 5 file not found...
0
compdigit44Author Commented:
I am sorry one of my co-workers was helping me write then left for vacation
0
compdigit44Author Commented:
Disregard my post about my error it was a typo. New error is permision denied for %userprofile%
0
MacroShadowCommented:
Try this:
Dim oWsh, strUserProfile , oFSO, oFile

Call LogEntry("TEST")

Function LogEntry (LogEntryText)
     Set oWsh = WScript.CreateObject("WScript.Shell")
     strUserProfile = oWsh.ExpandEnvironmentStrings("%userprofile%")
     Set oFSO = CreateObject("Scripting.FileSystemObject")
     Set oFile = oFSO.CreateTextFile(strUserProfile & "\file.txt")
     oFile.Close
     Set oFile = oFSO.OpenTextFile(strUserProfile & "\file.txt", 8, True, 0)
     oFile.WriteLine "<![LOG[" & LogEntryText & "]LOG]!><time=""" & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now) & ".001+240"" date=""" & Replace(Date(), "/", "-") & """ component=""PrintMapDelete"" context="""" type=""1"" thread=""0"" file=""" & WScript.Application & " " & WScript.Version & """>"
End Function

Open in new window

0
compdigit44Author Commented:
Thanks this seems to be working, although I do not understand something.

In lines 9 & 11 if I rename the file.txt I get a Permission Denied message. Yet it works fine with file.txt

From what I am finding online it seems to be caused by the fact the file could already be open or present. Yet, I have set the file write to append and we are already closing the connection before reading it.
0
compdigit44Author Commented:
I have confirm the script is creating the file in the correct location but nothing is getting written to it. The script is close the file after creating it so I am at a loss as to the problem
0
ploftinCommented:
The top portion of your script should look as follows:

Dim oWsh, strUserProfile, oFSO, oFile, strFile

 Call LogEntry("LogEntryText")

 Function LogEntry(LogEntryText)
     Set oWsh = WScript.CreateObject("WScript.Shell")
     strUserProfile = oWsh.ExpandEnvironmentStrings("%userprofile%")
     strFile = strUserProfile & "\file.txt"
     Set oFSO = CreateObject("Scripting.FileSystemObject")
     If Not oFSO.FileExists(strFile) Then
         oFSO.CreateTextFile strFile
     End If
     Set oFile = oFSO.OpenTextFile(strFile, 8, 0)
     oFile.WriteLine "<![LOG[" & LogEntryText & "]LOG]!><time=""" & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now) & ".001+240"" date=""" & Replace(Date, "/", "-") & """ component=""PrintMapDelete"" context="""" type=""1"" thread=""0"" file="""    '& WScript.Application & " " & WScript.Version & """>"
 End Function

Open in new window


The problem is you're assigning oFile when you're creating the file and then you're trying to assign it again when you're opening it for appending.
0
compdigit44Author Commented:
I got the same error again using the code you suggested... :o(
0
ploftinCommented:
How are you executing the script?  Are you double-clicking it, running it from a command prompt using 'cscript scriptname.vbs' or are you assigning this as a startup script that runs when the computer boots?
0
compdigit44Author Commented:
For testing purposes I am double clicking the script from my desktop but plan on deploying it via a group policy login script
0
compdigit44Author Commented:
I just tried to run it using cscript from the command line and got the same permission denined error
0
compdigit44Author Commented:
the script is creating the file but not able to write to it after it is created
0
compdigit44Author Commented:
I have read online this has nothing to do with a permission problem persay but have to do with the fact the CreateTextFile method is beging used and is failing on the opentextfile method becusae the file is already open.

The suggestion has been to write to the reference instead.. Does anyone know what they are referring to?
http://stackoverflow.com/questions/369242/vbscript-fso-opentextfile-permission-denied
0
ploftinCommented:
The reference is correct.  If you create the text file and leave it open, such as:

Set objFile = objFSO.CreateTextFile(strFile)

Open in new window


Then objFile has the file locked.  However, in the code I'm proposing, we're creating the text file with:

oFSO.CreateTextFile strFile

Open in new window


And this does not leave the file open.  If you're using the block of text below, exactly as I have it, it should run with no issues.  I've written to the log file several times with no issues.  I can run it over and over and it appends properly.

Dim oWsh, strUserProfile, oFSO, oFile, strFile

 Call LogEntry("LogEntryText")

 Function LogEntry(LogEntryText)
     Set oWsh = WScript.CreateObject("WScript.Shell")
     strUserProfile = oWsh.ExpandEnvironmentStrings("%userprofile%")
     strFile = strUserProfile & "\file.txt"
     Set oFSO = CreateObject("Scripting.FileSystemObject")
     If Not oFSO.FileExists(strFile) Then
         oFSO.CreateTextFile strFile
     End If
     Set oFile = oFSO.OpenTextFile(strFile, 8, 0)
     oFile.WriteLine "<![LOG[" & LogEntryText & "]LOG]!><time=""" & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now) & ".001+240"" date=""" & Replace(Date, "/", "-") & """ component=""PrintMapDelete"" context="""" type=""1"" thread=""0"" file="""    '& WScript.Application & " " & WScript.Version & """>"
 End Function

Open in new window


Try just that code snippet in a vbs file all by itself and see if it works - it should.  Perhaps you're experiencing another issue that we're not seeing the code for.
0
compdigit44Author Commented:
Thanks for the reply I am using the exact code of posted earlier and getting the same permission denied at line 13 which is:    

Set oFile = oFSO.OpenTextFile(strFile, 8, 0)
0
compdigit44Author Commented:
Here is my code....
Dim oWsh, strUserProfile, oFSO, oFile, strFile

 Call LogEntry("LogEntryText")

 Function LogEntry(LogEntryText)
     Set oWsh = WScript.CreateObject("WScript.Shell")
     strUserProfile = oWsh.ExpandEnvironmentStrings("%userprofile%")
     strFile = strUserProfile & "\file.txt"
     Set oFSO = CreateObject("Scripting.FileSystemObject")
     If Not oFSO.FileExists(strFile) Then
         oFSO.CreateTextFile strFile
     End If
     Set oFile = oFSO.OpenTextFile(strFile, 8, 0)
     oFile.WriteLine "<![LOG[" & LogEntryText & "]LOG]!><time=""" & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now) & ".001+240"" date=""" & Replace(Date, "/", "-") & """ component=""PrintMapDelete"" context="""" type=""1"" thread=""0"" file="""    '& WScript.Application & " " & WScript.Version & """>"
 End Function

strSrvName1 = "\\server1\HP"
strSrvName2 = "\\server2\Dell"

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set colPrinters = WshNetwork.EnumPrinterConnections
For intPrinter = 0 To colPrinters.Count - 1 Step 2
	strPrinterPort = colPrinters(intPrinter)
	strPrinterName = colPrinters(intPrinter + 1)
	LogEntry strPrinterName & " - " & strPrinterPort

	If left(colPrinters.Item(intPrinter + 1),len(strSrvName1)) = strSrvName1 Then
		LogEntry "	Printer matches target name.  Printer will be deleted"
		On Error Resume Next
		WshNetwork.RemovePrinterConnection strPrinterName
		If Err.Number = 0 Then
			LogEntry "	Printer was succesfully deleted"
		Else
			LogEntry "	An error occured while deleting the printer.  Error Number: " & Err.Number & " Error Description: " & Err.Description
		End If
	Else
		LogEntry "	Printer does not match target name.  No action required"
	End If

If left(colPrinters.Item(intPrinter + 1),len(strSrvName2)) = strSrvName2 Then
		LogEntry "	Printer matches target name.  Printer will be deleted"
		On Error Resume Next
		WshNetwork.RemovePrinterConnection strPrinterName
		If Err.Number = 0 Then
			LogEntry "	Printer was succesfully deleted"
		Else
			LogEntry "	An error occured while deleting the printer.  Error Number: " & Err.Number & " Error Description: " & Err.Description
		End If
	Else
		LogEntry "	Printer does not match target name.  No action required"
	End If
Next

Open in new window

0
ploftinCommented:
I'm wondering if perhaps another script or program is still running and has the file locked.

Can you please open Task Manager (CTRL + SHIFT + ESCAPE), change to the processes view (or Details view on Windows 8), and look for any processes called 'wscript' or 'wscript.exe'.  If you find any, end task on them.  Then try the script again.
0
compdigit44Author Commented:
Nothing is using the script an I only see the one instance of wscript and it goes away  after I close the error dialog box

I have tried three different computers all with the same result

 I am not a scripting person but trying hard to research this error and do not get what I am doing wrong..
0
compdigit44Author Commented:
Any ideas!!!!

I have even tried to change the file location to C:\ on my workstation which I have local admin rights on and still get permission denied.. I am at a total lose an need to find a solution for this is week .. :o(
0
MacroShadowCommented:
I missed most of the discussion, did the code I wrote work? It worked fine for me.
0
compdigit44Author Commented:
I got the same error using your code.

Tried three different workstations 2 Windows 7 and 1 Windows 8 all gave permission denied error.

Why is this failing I am trying so hard to research this and stumped
0
MacroShadowCommented:
This is the file my code created, is this what it should look like?
file.txt
0
compdigit44Author Commented:
Yes it does contain that text but a dialg box comes up with permission denied...
0
MacroShadowCommented:
when do you get the permission denied?
0
compdigit44Author Commented:
As soon as I double click the script to run an it is always on the OpenTextFile line.


 I did find something interesting. When I copy the script to my %username%b directory and run it from there I get Path Not Found.... This make me would if for some reason the script is not finding the %username% location...
0
MacroShadowCommented:
That's easy enough to find out. The following will display a message box with the user profile path:
Dim oWsh, strUserProfile , oFSO, oFile

Call LogEntry("TEST")

Function LogEntry (LogEntryText)
     Set oWsh = WScript.CreateObject("WScript.Shell")
     strUserProfile = oWsh.ExpandEnvironmentStrings("%userprofile%")
     MsgBox "The current users profile is located at: " & strUserProfile
     Set oFSO = CreateObject("Scripting.FileSystemObject")
     Set oFile = oFSO.CreateTextFile(strUserProfile & "\file.txt")
     oFile.Close
     Set oFile = oFSO.OpenTextFile(strUserProfile & "\file.txt", 8, True, 0)
     oFile.WriteLine "<![LOG[" & LogEntryText & "]LOG]!><time=""" & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now) & ".001+240"" date=""" & Replace(Date(), "/", "-") & """ component=""PrintMapDelete"" context="""" type=""1"" thread=""0"" file=""" & WScript.Application & " " & WScript.Version & """>"
End Function

Open in new window

0
MacroShadowCommented:
I just noticed, your not using %username% right? you need %userprofile%.
0
compdigit44Author Commented:
Sorry ... my script is using %userprofile% I was testing different combinations when I was trying to figure this out.

 I ran you test script from my desktop an it ran perfectly and showed by path as C:\users\MyName
0
MacroShadowCommented:
Does the script write the text to the text file?
0
compdigit44Author Commented:
Yes the script did write to the file.txt
0
MacroShadowCommented:
In which case I fail to see what the problem is.
0
compdigit44Author Commented:
This is why I am confused when I run the whole script just like I ran your test script I get permisson denied. I am using the same script I posted earlier.
0
MacroShadowCommented:
Does this script work:
strSrvName1 = "\\server1\HP"
strSrvName2 = "\\server2\Dell"

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set colPrinters = WshNetwork.EnumPrinterConnections
For intPrinter = 0 To colPrinters.Count - 1 Step 2
    strPrinterPort = colPrinters(intPrinter)
    strPrinterName = colPrinters(intPrinter + 1)
    LogEntry strPrinterName & " - " & strPrinterPort

    If Left(colPrinters.Item(intPrinter + 1), Len(strSrvName1)) = strSrvName1 Then
        LogEntry "  Printer matches target name.  Printer will be deleted"
        On Error Resume Next
        WshNetwork.RemovePrinterConnection strPrinterName
        If Err.Number = 0 Then
            LogEntry "  Printer was succesfully deleted"
        Else
            LogEntry "  An error occured while deleting the printer.  Error Number: " & Err.Number & " Error Description: " & Err.Description
        End If
    Else
        LogEntry "  Printer does not match target name.  No action required"
    End If

    If Left(colPrinters.Item(intPrinter + 1), Len(strSrvName2)) = strSrvName2 Then
        LogEntry "  Printer matches target name.  Printer will be deleted"
        On Error Resume Next
        WshNetwork.RemovePrinterConnection strPrinterName
        If Err.Number = 0 Then
            LogEntry "  Printer was succesfully deleted"
        Else
            LogEntry "  An error occured while deleting the printer.  Error Number: " & Err.Number & " Error Description: " & Err.Description
        End If
    Else
        LogEntry "  Printer does not match target name.  No action required"
    End If
Next

Function LogEntry(LogEntryText)
     Set oWsh = WScript.CreateObject("WScript.Shell")
     strUserProfile = oWsh.ExpandEnvironmentStrings("%userprofile%")
     MsgBox "The current users profile is located at: " & strUserProfile
     Set oFSO = CreateObject("Scripting.FileSystemObject")
     Set oFile = oFSO.CreateTextFile(strUserProfile & "\file.txt")
     oFile.Close
     Set oFile = oFSO.OpenTextFile(strUserProfile & "\file.txt", 8, True, 0)
     oFile.WriteLine "<![LOG[" & LogEntryText & "]LOG]!><time=""" & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now) & ".001+240"" date=""" & Replace(Date, "/", "-") & """ component=""PrintMapDelete"" context="""" type=""1"" thread=""0"" file=""" & WScript.Application & " " & WScript.Version & """>"
     oFile.Close
End Function

Open in new window

0
compdigit44Author Commented:
Well I do not get a permissoin denied error but I get a dialog box that pops up showing by location as C:\users\MyUser name but will not go away when we click on it.

I think we " You" are getting close .. You are scripting master!!!!
0
MacroShadowCommented:
Delete line 41.
0
compdigit44Author Commented:
It working with no errors.. The only thing I noticed in the log file it that it states the printer was deleted but does listed which on..

Thank you so much for your help
0
MacroShadowCommented:
I'm sorry I don't understand. What information is missing?
0
compdigit44Author Commented:
Sorry for the poor explanation. There are no errors and the script runs perfectly..  I noticed in the file.txt file it states a printer was deleted or not deleted but doesn't the the printer's name
0
MacroShadowCommented:
Try this script, does it give you the names?
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    Set oDrives = WshNetwork.EnumNetworkDrives
    Set oPrinters = WshNetwork.EnumPrinterConnections
    For i = 0 to oDrives.Count - 1 Step 2
        WScript.Echo "Drive " & oDrives.Item(i) & " = " & oDrives.Item(i+1)
    Next

Open in new window

0
compdigit44Author Commented:
Should I run this script as it or add it to the order script you wrote earlier today?
0
MacroShadowCommented:
Run it separately.
0
compdigit44Author Commented:
I ran the script but it brought up a dialog box with my home folder path and nothing about printers.
0
MacroShadowCommented:
Sorry my bad, try this script:
         Set WshNetwork = WScript.CreateObject("WScript.Network")
         Set oDrives = WshNetwork.EnumNetworkDrives
         Set oPrinters = WshNetwork.EnumPrinterConnections
         WScript.Echo "Network drive mappings:"
         For i = 0 to oDrives.Count - 1 Step 2
            WScript.Echo "Drive " & oDrives.Item(i) & " = " & oDrives.Item(i+1)
         Next
         WScript.Echo 
         WScript.Echo "Network printer mappings:"
         For i = 0 to oPrinters.Count - 1 Step 2
            WScript.Echo "Port " & oPrinters.Item(i) & " = " & oPrinters.Item(i+1)
         Next

Open in new window

0
compdigit44Author Commented:
After multiple dialog boxes if does end up listing my printers..
0
MacroShadowCommented:
Is this OK:
strSrvName1 = "\\server1\HP"
strSrvName2 = "\\server2\Dell"

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set colPrinters = WshNetwork.EnumPrinterConnections
For intPrinter = 0 To colPrinters.Count - 1 Step 2
    strPrinterPort = colPrinters.Item(intPrinter)
    strPrinterName = colPrinters.Item(intPrinter + 1)
    LogEntry strPrinterName & " - " & strPrinterPort

    If Left(colPrinters.Item(intPrinter + 1), Len(strSrvName1)) = strSrvName1 Then
        LogEntry "  Printer matches target name.  Printer will be deleted"
        On Error Resume Next
        WshNetwork.RemovePrinterConnection strPrinterName
        If Err.Number = 0 Then
            LogEntry "  Printer was succesfully deleted"
        Else
            LogEntry "  An error occured while deleting the printer.  Error Number: " & Err.Number & " Error Description: " & Err.Description
        End If
    Else
        LogEntry "  Printer does not match target name.  No action required"
    End If

    If Left(colPrinters.Item(intPrinter + 1), Len(strSrvName2)) = strSrvName2 Then
        LogEntry "  Printer matches target name.  Printer will be deleted"
        On Error Resume Next
        WshNetwork.RemovePrinterConnection strPrinterName
        If Err.Number = 0 Then
            LogEntry "  Printer was succesfully deleted"
        Else
            LogEntry "  An error occured while deleting the printer.  Error Number: " & Err.Number & " Error Description: " & Err.Description
        End If
    Else
        LogEntry "  Printer does not match target name.  No action required"
    End If
Next

Function LogEntry(LogEntryText)
     Set oWsh = WScript.CreateObject("WScript.Shell")
     strUserProfile = oWsh.ExpandEnvironmentStrings("%userprofile%")
     MsgBox "The current users profile is located at: " & strUserProfile
     Set oFSO = CreateObject("Scripting.FileSystemObject")
     Set oFile = oFSO.CreateTextFile(strUserProfile & "\file.txt")
     oFile.Close
     Set oFile = oFSO.OpenTextFile(strUserProfile & "\file.txt", 8, True, 0)
     oFile.WriteLine "<![LOG[" & LogEntryText & "]LOG]!><time=""" & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now) & ".001+240"" date=""" & Replace(Date, "/", "-") & """ component=""PrintMapDelete"" context="""" type=""1"" thread=""0"" file=""" & WScript.Application & " " & WScript.Version & """>"
     oFile.Close
End Function

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
compdigit44Author Commented:
It think it is working!!!

 I have to test it some more but so far it is looking good..........

You are a master... If I could award 50,000 points for this would ..

 I will post back shortly.
0
compdigit44Author Commented:
Everything worked perfectly. Thank you so much for your help. Script is one of those things I have wanted to learn and even though this was stressfull I did learn something as well!!!!!
0
MacroShadowCommented:
Glad it worked. Thanks for the points.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.