> I think you need to include all four backslashes:
>
> & "'Win32_Directory.Name=""c:\\\\SomePath\\\\SubDir""'")
>
> --
> urkec
>
>
> "Carolanne" wrote:
>
> > That sort of works.
> >
> > When I change "." to "RemoteComputer" and change
> > "'Win32_Directory.Name=""C:\\\\SomePath""'"
> > to "'Win32_Directory.Name=""S:\\\\SomePath""'" it looks at the network drive.
> >
> > But what I need it to do is look at S:\\\\SomePath\\Subdirectory. It
> > doesn't like subdirectories. How can I get it to recognize directories
> > beyond the root? Thanks for your help urkec!
> >
> > "urkec" wrote:
> >
> > > I think you can replace
> > >
> > > strComputer = "."
> > >
> > > with
> > >
> > > strComputer = "RemoteComputerName"
> > >
> > > and then use local path:
> > >
> > > & "'Win32_Directory.Name=""C:\\\\SomePath""'"
> > >
> > > --
> > > urkec
> > >
> > >
> > > "Carolanne" wrote:
> > >
> > > > I have a script that will notify me when new files are added to a folder.
> > > > This works really well when I test it on my local computer but I need it to
> > > > monitor a network share. When I replace the local path (C:\Test) with with
> > > > the path to the network directory (S:\Shared\ShielahS) I get the "unparsable
> > > > query error." Here is my code. ANY help is very greatly appreciated!
> > > >
> > > > Option Explicit
> > > > 'On Error Resume Next
> > > >
> > > > 'Environment Constants
> > > > Const STRFrom = "ITSupport[ at ]kennedyusa.com" 'This is the address the email
> > > > will appear from
> > > > Const STRTo="carols[ at ]kennedyusa.com" 'Recipients of the email
> > > > Const SMTP_SERVER = "192.180.200.39"
> > > >
> > > >
> > > > Dim objFSO
> > > > Dim strComputer
> > > > Dim objWMIService
> > > > Dim colMonitoredEvents
> > > > Dim objLatestEvent
> > > > Dim objMail
> > > > Dim objStartFolder
> > > > Dim objFolder
> > > >
> > > >
> > > > strComputer = "."
> > > > Set objWMIService = GetObject("winmgmts:" _
> > > > & "{impersonationLevel=impersonate}!//" & _
> > > > strComputer & "/root/cimv2")
> > > > Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
> > > > ("SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE " _
> > > > & "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
> > > > & "TargetInstance.GroupComponent= " _
> > > > & "'Win32_Directory.Name=""C:\\\\Test""'")
> > > >
> > > > Do
> > > > Set objLatestEvent = colMonitoredEvents.NextEvent
> > > > 'Wscript.Echo objLatestEvent.TargetInstance.PartComponent
> > > > SendMail
> > > >
> > > > Loop
> > > >
> > > > Sub SendMail
> > > >
> > > > Set objMail = CreateObject ("CDO.Message")
> > > > Set objFSO = CreateObject("Scripting.filesystemObject")
> > > >
> > > > objMail.Configuration.Fields.Item
> > > > ("
http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
> > > > objMail.Configuration.Fields.Item
> > > > ("
http://schemas.microsoft.com/cdo/configuration/smtpserver") =
> > > > SMTP_SERVER
> > > > objMail.Configuration.Fields.Item
> > > > ("
http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
> > > > objMail.Configuration.Fields.Update
> > > >
> > > > objMail.From = STRFrom
> > > > objMail.To = STRTo
> > > > 'objMail.CC=STRCC
> > > >
> > > > objMail.Subject = "There is a new lease ready for review"
> > > > objMail.Textbody = "This is an autogenerated message. Please do not respond
> > > > to this messsage." & vbCRLF & _
> > > > "A new lease has been placed in the following location:
> > > > S:\ShielahS\IN\." & vbCRLF & vbCRLF & _
> > > > "File name:" & (Mid(objLatestEvent.TargetInstance.PartComponent,49))
> > > >
> > > > objMail.Send
> > > >
> > > > Set objMail = Nothing
> > > > End Sub
> > > >
> > > >
> > > >
> > > >