Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Formatting Heck

$
0
0

I have this code and it works.

 

foreach ($Machine in Get-Content "c:\temp\tmp\Machines.txt") {Get-WMIObject win32_mappedlogicaldisk -ComputerName $Machine  | Select Name, ProviderName | fl} 

 

This will read the .txt file and then return all mapped drives for the "User" on the remote machine (very slick!).  

the output looks like this.

 

Name         : P:

ProviderName : \\mgmgs4ms\Medstreaming$

 

Name         : R:

ProviderName : \\MGMGS4MS\MGMainshare

 

 

I need to include the Machine Name for each machine.   I will run this against 50 machines or more and I'm not sure how to 1) add the machine name and 2) the proper way to format this.

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles