Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Powershell DFS size and free space providername Null / empty

$
0
0

Hello everyone,

 

I created a powershell script which will map UNC shares from a list. Then using win32_logicaldisk sets the information from Drive Q: to a array.

 

My problem is when running the script from a win2k3 server the$_.providername is NULL for DFS paths . The script returns drive values and freespace, but the providername is empty. Running the script from my winxp localmachine it works perfectly. Is there a setting in win2k3 server that is stopping this from querying properly? I've ran the script with my domain admin account with the same results.

 

I've seen some posts and link regarding the WMI Control under comp.management but i couldn't see a security setting that would be hindering the script.

 

Pasted below is my code, fairly straight-forward.

#array to store drive-share information collected
$drivespace = @()

# Read the text file initiates loop for each unc path
Get-Content c:\temp\unc_list.txt | ForEach-Object {
 
    # Maps temp network drive
    (New-Object -Com WScript.Network).MapNetworkDrive("Q:", $_)

    # Get the disk info
    $drivespace += get-wmiobject -class Win32_LogicalDisk -computername localhost| where{$_.DeviceID -eq"Q:"}
  
    #delete's mapped temp network drive
    net use Q: /Delete

}


Viewing all articles
Browse latest Browse all 15028

Trending Articles



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