Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Get list of mapped drives

$
0
0

I'm trying to get a list of mapped drives on some computers, as I suspect a couple of users have drives mapped that are not part of a group policy.

This works great, but only on my computer, 50% of the time.

Powershell
$computer=Read-Host'Enter computer name'$GWO_MappedDrives=get-wmiobject-Classwin32_mappedlogicaldisk-ComputerName'$computer'$MappedDrives=foreach($GWOMD_Itemin$GWO_MappedDrives){[PSCustomObject]@{DriveLetter=$GWOMD_Item.NamePath=$GWOMD_Item.ProviderName}}$MappedDrives

If I do 'localhost' all mapped drives are listed. If I do the name of my PC, only 4 drives are listed, Sometimes I get 'The RPC Server is unavailable', sometimes I don't. Sometimes I don't even get a result, it's just blank.

I tried this, which only gives me the 4 drives I would get with the other script, although they appear to...


Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>