From: rafoszcz on
I've been trying to get the following script to report on any new files that
might be added to a folder (a Ricoh AIO sends faxes to the folder
automatically). Each user on the network needs to be alerted to the incoming
faxes stored in the shared folder. Running it on the "host" works fine - it
reports any folder additions. Running it on a Windows Server 2008 share works
fine (that's where I tested it). However, running it on a peer-to-peer
Workgroup returns a runtime error in line 2, character 1 when the 10 second
"poll" period elapses:

800A01CE - The remote server machine does not exist or is unavailable:
'GetObject'.

Any help or guidance on where or why the script isn't working would be
appreciated!

Russ

=====

The script:

strComputer = "director"
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:\\\\shared\\\\_FAXSTORE""'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent
strNewFAX = objLatestEvent.TargetInstance.PartComponent
arrNewFile = Split(strNewFAX, "=")
strFileName = arrNewFile(1)
strFileName = Replace(strFileName, "\\", "\")
strFileName = Replace(strFileName, Chr(34), "")
Wscript.Echo "New FAX detected: " & strFileName
Loop


From: LikeToCode on
"rafoszcz" wrote: However, running it on a peer-to-peer Workgroup

Do the other computers in your workgroup know the IP address of the
"director" computer? If not you might need to add an entry in the hosts file
on each machine or change the value of strComputer from a DNS name to an IP
address.