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

Create CSV and rename some Labels

$
0
0

Greetings,

I've been reading on/off all day to find a way to manupulate the data I'm pulling from my script.  I'm somewhat of a noob but know how to use what I see for my own use.

I know this scrip can probably be made shorter but since I'm learning along the way, I'm planing on using this for future examples.

I know how to rename labels.  I selected the method in the script because its the only way I know how to convert bytes into RAM into MB or GB.

I leanred also how to use foreach to go through Win32_Physical memory to list each bank and how much memory is in.  However, I can't get it to work with the script I'm working on.  I guess I could change the format however, then the scrip would be formated multiple ways to display the information

I can get partial information or errors as it is

So I would like to query the following from each computer

How much memory

How much in each slot

Video card name

Video RAM

I forgot to mention, some computers are using multiple video card, so I would like to go through

and find all of the cards as well on each computer.

Thank you for your time

################ Code Below

$Workstations=Get-Content-Path C:\TEST\Computers.txt
$SaveLocation="C:\TEST"

Get-WmiObject-Class"Win32_ComputerSystem"-ComputerName$Workstations |

Select-Object-Property @{Name='ComputerName';Expression={$_.__SERVER}},

@{Name='Last User';Expression={$_.UserName}},
@{Name='Manufacturer';Expression={$_.Manufacturer}},
@{Name='Model';Expression={$_.Model}},
@{Name="TotalPhysicalMemory";Expression={[int]($_.TotalPhysicalMemory/1mb) }}

Get-WmiObject-Class Win32_VideoController -ComputerName$Workstations |

Select-Object-Property @{Name='Video';Expression={$_.Name}},

@{Name='AdapterRAM';Expression={[int]($_.AdapterRAM/1mb) }}

# Export-CSV -Path $SaveLocation\ComputerInformation.csv -NoTypeInformation

# Remove comment below to show on screen
Format-Table*-AutoSize

Viewing all articles
Browse latest Browse all 6937

Trending Articles