I am trying to get network mapped drives using below commands.
Get-WmiObject -Class Win32_MappedLogicalDisk | %{$_.Name}
Get-WmiObject -Class Win32_MappedLogicalDisk | %{$_.ProviderName}
This works in some system however does not in other systems(may be powershell version issue) So I thought of using net use command. However, I am unable to fetch the values or not sure how to get the values displays when i type 'net use'
when I type net use I get status, Local, Remote and Network column. I tried to use the below command to get the field values.
net use | select local.
but I get blank or nothing
Used below command.
net use | select local.
Need to get Local and Remote values from net use command.
NETis not a PowerShell command; it's an external program. As such, it does not pass structured objects into the PowerShell pipe, only text. TheSelect-Objectcmdlet expects a structured object, and will return the named member property from that object - in other words, in your example, it's expecting a structured object with a member property called "local.". You will need to parse the text.Get-PSDrive | Get-Member -Force. To get only FileSystem "drives," useGet-PSDrive | Where-Object { $_.Provider.Name -eq 'FileSystem' }.Get-PSDrive -PSProvider FileSystem