Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Here are my codes, $var.droppath is a valid network space path, I've test it.

$map3 = new-PSDrive -name droppath -psprovider FileSystem -root $var.droppath

Then I ran

Get-PSDrive | ?{$_.Name -match "droppath"} | FT -AutoSize

and got the result:

Name     Used (GB) Free (GB) Provider  Root                                                                                                 CurrentLocation
----     --------- --------- --------   ----                                                                                                 ---------------
droppath                     FileSystem \\network\sharespace\test1                                                                            

Why used space and free space are empty? Is that means get-psdrive can not mapping network space or I made some mistake?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

the Get-PSDrive tool only returns Free and Used information for providers that have that information available. Oddly enough, PS doesn't make that easy to get for the PS-Drives simply because it is really and alias that MIGHT map to something that doesn't have that info. PS-drives only survive the session so they aren't full OS level mappings. Thus you don't get OS level information like the remote space free.

The easy work-around is to use net use and map it to a real drive letter. Don't forget to tear it back down when you are done.

UPDATE I left out this link: query different free share spaces by powershell, but every time got the same result. which has some example code to do the mapping from PS and get the data you need manually.

share|improve this answer
    
@Mrak: Thanks a lot. So it doesn't work...I think I have to go back and met my previous solusion problem.. byt the way the link you've given is posted by me either... I have passed that stage but met some new problems here:serverfault.com/questions/288154/… –  pansal Jul 10 '11 at 2:41

Mark is correct, but looking at the TechNet article on Get-PSDrive here, you can see that by using get-wmiobject and the win32_logicaldisk class you can get free space and total space pretty easily.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.