Re: Getting "Access is Denied" when starting a ManagementEventWatc



Hi Carl,

are you connecting from XP to W2K-Server or
from W2K-Server to XP

with the install of SP2 some settings related to the
security were changed. Take a look at:
http://support.microsoft.com/default.aspx?scid=kb;en-us;875605

HTH

Bye
Peter


"Carl K" <CarlK@xxxxxxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag news:19A2F2C1-B4F0-492D-8FAF-F6018F37F4AE@xxxxxxxxxxxxxxxx
> Still getting access is denied. My system is XP SP2 and I have found that if
> I run the app on SP1 or Win2k there is no problem.
>
> I think I did everything with the firewall config described in other technet
> articles to open up the firewall for remote management calls, but apparently
> not.
>
> Can you tell me what specifically I would need to have configured on XP SP2
> to do this?
>
>
> "Peter Falz" wrote:
>
> > Hi Carl,
> >
> > what happens if you use the "Administrator"-account?
> > I don't mean a account with administrative rights but i mean
> > the "Administrator"-user itself.
> >
> > Bye
> > Peter
> >
> > "Carl K" <CarlK@xxxxxxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag news:89CEBEAB-DB0D-4537-B6D0-86597155CAF9@xxxxxxxxxxxxxxxx
> > > I have written an Winforms app to monitor and log all print jobs submitted to
> > > a print server. If I run the application on the print server, it works fine,
> > > but the point of the app was to run it from my client and connect to
> > > root\cimv2 on the remote print server.
> > >
> > > Here is the relevant code:
> > >
> > > '//////////////////////////////////////////
> > > Private Sub CreateWatcher()
> > >
> > > Dim myQuery As New WqlEventQuery
> > > myQuery.EventClassName = "__InstanceCreationEvent"
> > > myQuery.Condition = "TargetInstance ISA 'Win32_PrintJob'"
> > > myQuery.WithinInterval = New TimeSpan(0, 0, 0, 1, 250)
> > >
> > > Watcher = New ManagementEventWatcher(myQuery)
> > > Watcher.Scope = New ManagementScope("\\" & PrintServer &
> > > "\root\cimv2")
> > > Watcher.Scope.Options.Impersonation = ImpersonationLevel.Impersonate
> > > Watcher.Scope.Options.EnablePrivileges = True
> > > Watcher.Scope.Options.Username = "cklouda"
> > > Watcher.Scope.Options.Password = "password"
> > >
> > > Try
> > > Watcher.Scope.Connect()
> > > Console.WriteLine(Watcher.Query.QueryString.Trim)
> > > Catch ex As Exception
> > > Console.WriteLine(ex.Message)
> > > End Try
> > >
> > > AddHandler Watcher.EventArrived, AddressOf Arrived
> > > Try
> > > Watcher.Start()
> > >
> > > Catch accessEx As System.UnauthorizedAccessException
> > > Console.WriteLine(vbCrLf)
> > > Console.WriteLine(accessEx.Source & " - " & accessEx.Message)
> > > Console.WriteLine(accessEx.InnerException)
> > > Console.WriteLine(accessEx.TargetSite)
> > > Console.WriteLine(accessEx.StackTrace)
> > > Catch ex As Exception
> > >
> > > End Try
> > >
> > > End Sub
> > >
> > > '//////////////////////////////////////////////////////////////////
> > >
> > > When Watcher.Start() executes it returns an "Acces is Denied"
> > > from MSCorlib
> > >
> > > Now... the ID and password I use is for an account that is in the
> > > administrators group on the remote print server. I even went to the WMI
> > > config in the MMC on the remote print server and gave "Everyone" the "Remote"
> > > permission on Root\Cimv2
> > >
> > > To top it off, if I run the same code, Watcher.Scope.Connect() does not
> > > return an error, suggesting that the app has no problem connecting to
> > > root\cimv2 on the remote print server. So... I am at a loss as to what is
> > > causing the access is denied error...
> > >
> > > I am running WinXP SP2, the server I am connecting to is Win2000 Server
> > >
> > > Any help would be appreciated...
> >
> >
> >


.