You're quite right, the $ was actually left over from something I was doing
to check that answer before I posted it, and it's fine without.
I'm quite pleased that you were able to take my fairly simplistic answer,
and get to where you wanted to be. Isn't PowerShell fun? I make no pretense
of being a PowerShell guru - there are lots of those posting here, and
sometimes they simply amaze me. But I spent many, many years as a sysadmin
on unix and windows systems before I turned to writing about OSs full time,
and the part I really miss about being a full time admin is the scripting.
So I muck around a bit, and try to add scripts to my chapters as
appropriate, and I use PowerShell as my every day shell. And try to answer
the occasional question when I get the chance since it always makes me
stretch a bit.
--
Charlie.
http://msmvps.com/blogs/xperts64 http://mvp.support.microsoft.com/profile/charlie.russel
"DavieH" <DavieH@xxxxxx> wrote in message
news:E781D641-9F37-4975-B9C3-7C7D50085B89@xxxxxx
> I've been working on it and can figure the win32_logicaldisk class well
> enough to see where the available properties (filesystem and DeviceId)
> come
> from, and write an elaborate function to get the filesystem from a folder
> name!
> The simple way is to adapt the query you provided:-
>
> (Get-WMIObject win32_logicaldisk -filter "DeviceID = '$drive'").filesystem
>
> Why does it work without the $? What does the $ effectively do (or not
> do!)?
>
>
> Thanks,
> DavieH
> ===
>
>
> "Charlie Russel - MVP" wrote:
>
>> The thing is, WMI is almost easy in PowerShell. Seriously, I NEVER used
>> it
>> in VB - it was just too hard. But Get-WMIObject is definitely a lot
>> easier
>> to get your head around.
>>
>> --
>> Charlie. > ...
>> >> PSH> $Filesystem=$(Get-WMIObject win32_logicaldisk -filter "DeviceID =
>> >> 'D:'").filesystem >