Re: Win32_LogicalDisk Not Working Properly
- From: "Jim Vierra" <jvierra@xxxxxxx>
- Date: Tue, 7 Jun 2005 16:45:54 -0400
You are NOT creating an "actual" session. You are creating a remote WMI
session that can "impersonate" you.
There is a session class in WMI. Look it up. Enumerate the user session
you want to view and it's associators. You have to follow that chains and
detect the class of the object. It's not straight forward. You can also
retrieve mappings from any loaded profile hive.
--
Jim Vierra
"David Tilman" <DavidTilman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:BD3DD70C-53D1-4BD3-8E77-60C5EC94BB7E@xxxxxxxxxxxxxxxx
> 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
>> >
>>
>>
>>
.
- References:
- Win32_LogicalDisk Not Working Properly
- From: David Tilman
- Re: Win32_LogicalDisk Not Working Properly
- From: Jim Vierra
- Re: Win32_LogicalDisk Not Working Properly
- From: David Tilman
- Re: Win32_LogicalDisk Not Working Properly
- From: Jim Vierra
- Re: Win32_LogicalDisk Not Working Properly
- From: David Tilman
- Win32_LogicalDisk Not Working Properly
- Prev by Date: Re: Win32_LogicalDisk Not Working Properly
- Next by Date: Re: Win32_Printer.Location setting help
- Previous by thread: Re: Win32_LogicalDisk Not Working Properly
- Next by thread: Re: Win32_Printer.Location setting help
- Index(es):
Relevant Pages
|
Loading