I am diving back into PowerShell today. I need to see if i can figure out a way to feed a list of Server names and IP addresses to PowerShell and have it export to CSV all of the available drive letters for the system. If anyone can assist, it would be greatly appreciated.
Thanks much
Subscribe to:
Post Comments (Atom)
6 comments:
So you have a list of servers and for each one you would want a row in n a CSV of the drive letters available on that server? A la:
Server1, E;J;M;Z
192.34.56.78, F;H;X;y
@EBGreen, yup. That is exactly what i am looking for. Playing with get-content to read the file and then get-WMIObject Win32_LogicalDisk
See if this works (or at least points you in the right direction):
$result = @()
foreach($server in (Get-Content C:\temp\test.txt))
{
$temp = New-Object PsCustomObject
$drives = Get-WMIObject -Computer $server -Class Win32_LogicalDisk | Select-Object -ExpandProperty DeviceID
Add-Member -InputObject $temp -MemberType NoteProperty -Name Server -value $server
Add-Member -InputObject $temp -MemberType NoteProperty -Name Drives -value ([string]::Join(';', $drives))
$result += $temp
}
$result | Export-Csv C:\temp\test.csv
uggg...watchout for the extra line breaks that the blog formatting put in there.
Go here to get it without breaks:
http://poshcode.org/1058
he shoots and he SCORES!!!
Thanks for that, this is exactly what i was looking for!
app
Post a Comment