From: Leon on 21 Dec 2009 09:04 Hi I want to monitor a folder on a remote server with this littlæe script. But - access denied.. How do I put in user and password? strComputer = "remoteserver" Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & _ strComputer & "\root\cimv2") Set colMonitoredEvents = objWMIService.ExecNotificationQuery _ ("SELECT * FROM __InstanceCreationEvent WITHIN 0.1 WHERE " _ & "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _ & "TargetInstance.GroupComponent= " _ & "'Win32_Directory.Name=""e:\\\\Temp""'") Do Set objLatestEvent = colMonitoredEvents.NextEvent Wscript.Echo objLatestEvent.TargetInstance.PartComponent Loop
From: urkec on 21 Dec 2009 11:18 "Leon" wrote: > Hi > > I want to monitor a folder on a remote server with this littlæe > script. > But - access denied.. How do I put in user and password? > > strComputer = "remoteserver" > Set objWMIService = GetObject("winmgmts:" _ > & "{impersonationLevel=impersonate}!\\" & _ > strComputer & "\root\cimv2") > Set colMonitoredEvents = objWMIService.ExecNotificationQuery _ > ("SELECT * FROM __InstanceCreationEvent WITHIN 0.1 WHERE " _ > & "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _ > & "TargetInstance.GroupComponent= " _ > & "'Win32_Directory.Name=""e:\\\\Temp""'") > Do > Set objLatestEvent = colMonitoredEvents.NextEvent > Wscript.Echo objLatestEvent.TargetInstance.PartComponent > Loop > . > Use SWbemLoactor to connect to thhe remote computer: http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.scripting.vbscript&cat=en_US_8e0bf598-2567-4b0b-8241-d4942bda87dc&lang=en&cr=US You can find an example at the bottom of the page. -- urkec
From: Leon on 22 Dec 2009 18:26 Hi Thanks for the answer - but no access rights.. Then - I found out that mapping up the remote PC to a drive letter did solve the case. Cheers On 21 Dec., 17:18, urkec <ur...(a)discussions.microsoft.com> wrote: > "Leon" wrote: > > Hi > > > I want to monitor a folder on a remote server with this littlæe > > script. > > But - access denied.. How do I put in user and password? > > > strComputer = "remoteserver" > > Set objWMIService = GetObject("winmgmts:" _ > > & "{impersonationLevel=impersonate}!\\" & _ > > strComputer & "\root\cimv2") > > Set colMonitoredEvents = objWMIService.ExecNotificationQuery _ > > ("SELECT * FROM __InstanceCreationEvent WITHIN 0.1 WHERE " _ > > & "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _ > > & "TargetInstance.GroupComponent= " _ > > & "'Win32_Directory.Name=""e:\\\\Temp""'") > > Do > > Set objLatestEvent = colMonitoredEvents.NextEvent > > Wscript.Echo objLatestEvent.TargetInstance.PartComponent > > Loop > > . > > Use SWbemLoactor to connect to thhe remote computer: > > http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg... > > You can find an example at the bottom of the page. > > -- > urkec- Skjul tekst i anførselstegn - > > - Vis tekst i anførselstegn -
|
Pages: 1 Prev: VBS Signature for Outlook - Containing a Hyperlink Next: HTA VBscript MapIP Printing |