Asked by:
win32_volume | where clause to exclude the drives listing with \?\Volume{

Question
-
Using powershell to collect disk usage details and report to my email id for 40+servers. The code is displaying some extra drive details with \\?\Volume{ for each server.. But these drive is not mount drive or even a local disk. How to exclude it using where clause.
Existing code:
Get-wmiobject -computername $computer -class win32_volume - filter "drivetype =3" - errorAction Stop
eg ouput: - I need to exclude the row has \\?\volume
Drive Total Capacity(GB) Used Capacity(GB) Free Space(GB) Freespace % ILM
C:\ 33.91 28.54 5.37 15.84 NA
E:\ 29.97 18.24 11.73 39.15 NA
G:\ 2.01 0.15 1.86 92.92 NA
H:\ 18.01 0.130000000000003 17.88 99.31 NA
I:\ 14.01 5.74 8.27 59.02 NA
J:\ 12.01 5.75 6.26 52.15 NA
\\?\Volume{c057d2e7-ff2a-11e8-816e-005056ad560f}\ 80 12.63 67.37 84.21 NA
\\?\Volume{c057d2ee-ff2a-11e8-816e-005056ad560f}\ 150 0.0900000000000034 149.91 99.94 NA
\\?\Volume{c057d2f7-ff2a-11e8-816e-005056ad560f}\ 4.98 0.0500000000000007 4.93 98.95
vijayasarathi
- Edited by Vijayasarathi1 Friday, December 14, 2018 9:35 AM
Friday, December 14, 2018 6:30 AM
All replies
-
Get-wmiobject win32_volume -filter 'DriveType=3 AND DriveLetter IS NOT NULL'
\_(ツ)_/
- Proposed as answer by LeeSeenLiMicrosoft contingent staff Monday, December 24, 2018 3:10 AM
Friday, December 14, 2018 8:07 AM -
I have tried this code and it is now not diplaying my mount drives..
see the output:
C:\ 60 32.26 27.74 46.24 NA E:\ 40 21.07 18.93 47.33 NA F:\ 80 0.099999999999994 79.9 99.87 NA G:\ 8 0.04 7.96 99.5 NA H:\ 1 0.03 0.97 97.55 NA I:\ 1 0.03 0.97 97.55 NA J:\ 1 0.03 0.97 97.55 NA L:\ 1 0.03 0.97 97.55 NA <style type="text/css">body,div,table,thead,tbody,tfoot,tr,th,td,p { font-family:"Arial"; font-size:x-small } a.comment-indicator:hover + comment { background:#ffd; ; display:block; border:1px solid black; padding:0.5em; } a.comment-indicator { background:red; display:inline-block; border:1px solid black; width:0.5em; height:0.5em; } comment { display:none; } </style>
My previous output:
C:\ 60 32.26 27.74 46.24 NA E:\ 40 21.07 18.93 47.33 NA F:\ 80 0.099999999999994 79.9 99.87 NA G:\ 8 0.04 7.96 99.5 NA H:\ 1 0.03 0.97 97.55 NA I:\ 1 0.03 0.97 97.55 NA J:\ 1 0.03 0.97 97.55 NA L:\ 1 0.03 0.97 97.55 NA G:\SYS\ 8 0.82 7.18 89.81 NA G:\DBA\ 8 0.59 7.41 92.69 NA G:\AUD\ 50 3.54 46.46 92.92 NA H:\BAK\ 87 0.209999999999994 86.79 99.76 NA I:\DAT\ 60 0.399999999999999 59.6 99.35 NA J:\LOG\ 20 0.140000000000001 19.86 99.31 NA L:\TMP\ 20 0.129999999999999 19.87 99.35 NA \\?\Volume{ce36db3c-64c2-4283-8eba-b2c31c55da86}\ 60 10.24 49.76 82.93 NA I would need to just eliminate the entry with \\?\Volume{
<style type="text/css"><br _moz_dirty="" /></style>
vijayasarathi
Friday, December 14, 2018 9:30 AM -
So just filter out what you don't want.
\_(ツ)_/
Friday, December 14, 2018 10:17 AM -
Label and driveletter filtering is not working as some servers are need to display with label data even if drive letter is null.. can we filter with name column something like below,
Name not like '\\?\volume*'
vijayasarathi
Friday, December 14, 2018 12:44 PM -
How about (although my output looks nothing like that). Note that ? is a wildcard.
| where name -notlike \\?\Volume*
- Edited by JS2010 Friday, December 14, 2018 7:04 PM
- Proposed as answer by LeeSeenLiMicrosoft contingent staff Monday, December 24, 2018 3:10 AM
Friday, December 14, 2018 5:53 PM -
Hi,
Was your issue resolved?
If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.
If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.
If no, please reply and tell us the current situation in order to provide further help.
Best Regards,
Lee
Just do it.
Monday, December 17, 2018 7:45 AM -
Hi,
Was your issue resolved?
If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.
If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.
If no, please reply and tell us the current situation in order to provide further help.
Best Regards,
Lee
Just do it.
Monday, December 24, 2018 3:10 AM