Re: Win32_LogicalDisk Not Working Properly



OK, now I see what you are saying. I didn't realize that I was creating an
actual session by doing a WMI query. Just before I do the WMI query with
Win32_LogicalDisk, I do this:

Set colItems = objWMIService.ExecQuery("Select * from
Win32_ComputerSystem",,48)
For Each objItem In colItems
txtResults.Value = txtResults.Value & "Computer: " & objItem.Name & vbCrLf
txtResults.Value = txtResults.Value & "UserName: " & objItem.UserName &
vbCrLf
Next

Which only showed one user - the one that is physically logged in to the
computer, so I was thrown off by that. How would I go about enumerating the
session? I can't seem to find any information regarding that with WMI.

"Jim Vierra" wrote:

> Doesn't matter if the user is logged in. The mappings are only shown for
> the session you are remotely impersonating which is not interactive and
> doesn't have any mapped drives. You need to enum sessions and find the
> associators of the users session to see there mapped drives. You can't do
> it any other way that I can think of. A raw computer does not have any
> mapped drives. Only user sessions have drive mappings and only when running
> interactively.
>
> You will see drives that are physically on the computer and perhaps a drive
> that has become involved in a system process like a virus scan or
> replication.
>
> On W98 you may see the mapped drives as there is no real differentiation
> between a user session and a system session.
>
> --
> Jim Vierra
>
> "David Tilman" <DavidTilman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:1C34D79A-EADC-4642-B1C1-9E18157BDE81@xxxxxxxxxxxxxxxx
> > Thank you for the response. If I'm understanding you correctly, I have
> > taken
> > this into account. When I'm querying these computers I know the user is
> > logged in. For instance, a user is logged into his computer and has 4
> > drives
> > mapped (J:, H:, R:, S:). My script shows only one drive mapped (R:) and
> > shows
> > the ProviderName variable for this share as an empty string. Another test
> > I
> > tried was to query my main computer that I'm logged into with my regular
> > account from my test computer (logged in with my domain admin account). I
> > have 3 mapped network drives and the script is showing no mapped drives.
> > I've
> > tried querying about 5 different computer with users logged in with
> > varying
> > results. I would think that I would either see all of the drives or none
> > of
> > the drives.
> >
> > Or are you suggesting that I can't see the J:, H:, & S: drives from the
> > script, because my account would be restricted from those paticular
> > shares? I
> > do have the same share mapped to my J: drive as the remote computer does.
> > Is
> > there something else that I'm missing?
> >
> > "Jim Vierra" wrote:
> >
> >> Read the individual field infos carefully. They are not all they may
> >> seem
> >> to be.
> >>
> >> ProviderName is the "Network Path" of a share. Visibility of the share
> >> is
> >> dependent on the account the share is mapped with and not on the system
> >> itself.
> >>
> >> You would need to query the account associations to find remote shares.
> >> It
> >> appears that when you run it locally you are logged in and the mapped
> >> drives
> >> are connected so they show up. Remote queries are not "interactive" so
> >> the
> >> mappings are not available. The WMI query only shows what is available
> >> to
> >> the account running the query.
> >>
> >> Hope this is clear.
> >> Here is the docs link.
> >> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_logicaldisk.asp
> >>
> >> --
> >> Jim Vierra
> >
>
>
>
.



Relevant Pages


Loading