From: Leon on 2 Sep 2010 10:00 Hi Unsure to which group is the right for this. I want catch windows event via WMI from a remote server. on this server a mounted drive "K" exists. Using this code.. Log on is with no error but - the events is not catched... '----------------------------------------------------------------------------------------------------------------------- objSWbemLocator = CreateObject("WbemScripting.SWbemLocator") objSWbemServices = objSWbemLocator.ConnectServer(strComputer, _ "root\cimv2", _ strUser, _ strPassword, _ "MS_409", _ "ntlmdomain:" + strDomain) '>>> this fails colFiles = objSWbemServices.ExecQuery _ ("Select * from CIM_Datafile Where Name = 'K:\\myfile.txt'") '----------------------------------------------------------------------------------------------------------------------- Is there a way to pass event to my local computer from this mounted drive? Cheers
From: Tom Lavedas on 2 Sep 2010 11:18 On Sep 2, 10:00 am, Leon <kim.zeth...(a)gmail.com> wrote: > Hi > > Unsure to which group is the right for this. > > I want catch windows event via WMI from a remote server. > on this server a mounted drive "K" exists. > > Using this code.. > Log on is with no error but - the events is not catched... > '----------------------------------------------------------------------------------------------------------------------- > objSWbemLocator = CreateObject("WbemScripting.SWbemLocator") > > objSWbemServices = objSWbemLocator.ConnectServer(strComputer, > _ > "root\cimv2", _ > strUser, _ > strPassword, _ > "MS_409", _ > "ntlmdomain:" + strDomain) > > '>>> this fails > colFiles = objSWbemServices.ExecQuery _ > ("Select * from CIM_Datafile Where Name = > 'K:\\myfile.txt'") > '----------------------------------------------------------------------------------------------------------------------- > > Is there a way to pass event to my local computer from this mounted > drive? > > Cheers That's not an event, it's a query, but that's not the problem. The problem is that the query returns a collection, so the reserved word SET is required to fulfill the language syntax requirements. Try ... set colFiles = objSWbemServices.ExecQuery _ ("Select * from CIM_Datafile Where Name = 'K:\ \myfile.txt'") BTW, if I'm not mistaken, the drive K: must be accessible to the user you are using to log in to the machine. Otherwise, I would expect this query to fail, even when you correct the syntax. Considering your statement that you're trying to catch some event, I suspect this still doesn't answer your really intent. Maybe you can explain what it is you want to accomplish, without regard to the way you are trying to do it, so that others might offer better advice. _____________________ Tom Lavedas
From: Leon on 2 Sep 2010 15:03 hi Forgot to mention that this is not vbs but visual basic code. So the "set" is removed to fit the visual basic language nevertheless - the code is testet and works fine on a remote server with a "normal" drive. so I consider the code to be ok. But - the code does not work on a server with a mounted drive. Cheers On 2 Sep., 17:18, Tom Lavedas <tglba...(a)verizon.net> wrote: > On Sep 2, 10:00 am, Leon <kim.zeth...(a)gmail.com> wrote: > > > > > > > Hi > > > Unsure to which group is the right for this. > > > I want catch windows event via WMI from a remote server. > > on this server a mounted drive "K" exists. > > > Using this code.. > > Log on is with no error but - the events is not catched... > > '----------------------------------------------------------------------------------------------------------------------- > > objSWbemLocator = CreateObject("WbemScripting.SWbemLocator") > > > objSWbemServices = objSWbemLocator.ConnectServer(strComputer, > > _ > > "root\cimv2", _ > > strUser, _ > > strPassword, _ > > "MS_409", _ > > "ntlmdomain:" + strDomain) > > > '>>> this fails > > colFiles = objSWbemServices.ExecQuery _ > > ("Select * from CIM_Datafile Where Name = > > 'K:\\myfile.txt'") > > '----------------------------------------------------------------------------------------------------------------------- > > > Is there a way to pass event to my local computer from this mounted > > drive? > > > Cheers > > That's not an event, it's a query, but that's not the problem. The > problem is that the query returns a collection, so the reserved word > SET is required to fulfill the language syntax requirements. Try ... > > set colFiles = objSWbemServices.ExecQuery _ > ("Select * from CIM_Datafile Where Name = 'K:\ > \myfile.txt'") > > BTW, if I'm not mistaken, the drive K: must be accessible to the user > you are using to log in to the machine. Otherwise, I would expect > this query to fail, even when you correct the syntax. > > Considering your statement that you're trying to catch some event, I > suspect this still doesn't answer your really intent. Maybe you can > explain what it is you want to accomplish, without regard to the way > you are trying to do it, so that others might offer better advice. > _____________________ > Tom Lavedas- Skjul tekst i anførselstegn - > > - Vis tekst i anførselstegn -
From: Kenneth A. Larsen on 3 Sep 2010 10:15 "Tom Lavedas" <tglbatch(a)verizon.net> wrote in message news:6e4d2fda-196f-49ee-bfaf-e37e5463a3e1(a)g17g2000yqe.googlegroups.com... On Sep 2, 10:00 am, Leon <kim.zeth...(a)gmail.com> wrote: > Hi > > Unsure to which group is the right for this. > > I want catch windows event via WMI from a remote server. > on this server a mounted drive "K" exists. > > Using this code.. > Log on is with no error but - the events is not catched... > '----------------------------------------------------------------------------------------------------------------------- > objSWbemLocator = CreateObject("WbemScripting.SWbemLocator") > > objSWbemServices = objSWbemLocator.ConnectServer(strComputer, > _ > "root\cimv2", _ > strUser, _ > strPassword, _ > "MS_409", _ > "ntlmdomain:" + strDomain) > > '>>> this fails > colFiles = objSWbemServices.ExecQuery _ > ("Select * from CIM_Datafile Where Name = > 'K:\\myfile.txt'") > '----------------------------------------------------------------------------------------------------------------------- > > Is there a way to pass event to my local computer from this mounted > drive? > > Cheers That's not an event, it's a query, but that's not the problem. The problem is that the query returns a collection, so the reserved word SET is required to fulfill the language syntax requirements. Try ... set colFiles = objSWbemServices.ExecQuery _ ("Select * from CIM_Datafile Where Name = 'K:\ \myfile.txt'") BTW, if I'm not mistaken, the drive K: must be accessible to the user you are using to log in to the machine. Otherwise, I would expect this query to fail, even when you correct the syntax. Considering your statement that you're trying to catch some event, I suspect this still doesn't answer your really intent. Maybe you can explain what it is you want to accomplish, without regard to the way you are trying to do it, so that others might offer better advice. _____________________ Tom Lavedas Is K:/ a drive, because I never heard of it?
From: Todd Vargo on 3 Sep 2010 17:02
Kenneth A. Larsen wrote: > "Tom Lavedas" <tglbatch(a)verizon.net> wrote: snip... > > set colFiles = objSWbemServices.ExecQuery _ > ("Select * from CIM_Datafile Where Name = 'K:\ > \myfile.txt'") > > BTW, if I'm not mistaken, the drive K: must be accessible to the user > you are using to log in to the machine. Otherwise, I would expect > this query to fail, even when you correct the syntax. > > Considering your statement that you're trying to catch some event, I > suspect this still doesn't answer your really intent. Maybe you can > explain what it is you want to accomplish, without regard to the way > you are trying to do it, so that others might offer better advice. > _____________________ > Tom Lavedas > > > Is K:/ a drive, because I never heard of it? Yes. A: through Z: are valid drive letters. -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages) |