1.

Solve : powershell hash table editing?

Answer»

I'm WORKING on a powershell script that will walk through my network and get file version info on a few programs and want to add the computer name to the hash table for easier reviewing.
Here's what I'm using at the moment:

Code: [Select]$office = (get-childitem "\\$pc\C$\Program FILES (x86)\Microsoft Office\" -recurse -filter "excel.exe" ).VersionInfo
$office | select FileName, FileDescription, ProductMajorPart | ft -autosize
I want to add a column in the hash table to show the computer name, but am having trouble figuring out how to edit hashtables.
Any help would be appreciated. Thanks.I figured out something a little easier to work with. I CREATED a New-Object that I used to save the info I wanted from the Get-ChildName.
So, instead of the code above, it looks like this:

Code: [Select]$PCName = "test"
$a = (Get-ChildItem "\\$PCName\C$\Program Files (x86)\Microsoft Office\" -Recurse -Filter "excel.exe").VersionInfo
$pn = $office.ProductName
$PV = $office.ProductMajorPart
$pcinfo = New-Object psobject -Property @{""COMPUTERNAME"="$PCName"; "ProductName"="$pn";"ProductVersion"="$pv"}
$pcinfo +=$AllInfo




Discussion

No Comment Found