Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

changing value of path in hash table

$
0
0

Hi.  I am working on an App-V script and I am hoping that someone can help me out as I am stuck.

I am using "add-appvclientpackage" to populate a variable and the table looks like this:

PackageId            : ee24471a-fde0-4d32-afed-0a055f987c0e
VersionId            : 248a6b67-3503-4e2e-a9eb-25241aa04ccb
Name                 : CCleaner
Version              : 0.0.0.1
Path                 : C:\Temp\appv\001\CCleaner.appv
IsPublishedToUser    : True
UserPending          : False
IsPublishedGlobally  : False
GlobalPending        : False
InUse                : False
InUseByCurrentUser   : False
PackageSize          : 12085641
PercentLoaded        : 18
IsLoading            : False
HasAssetIntelligence : True

I need to be able to create a variable with this information so I can use "compare-object" to campare against an imported .CSV file in another variable.
1. I only need the "Path" and "name" properties in the variable but I also need "path" renamed to "slot" for the header.
2. I don't want the full path for the "path" property.  I just want the numbered directory in this example (001) that is directly above the .appv file.

Right now this is what I have and it almost does exactly what I want it to do.  I just need to be able to have the "name" value under the "name" header.

$local = Get-AppvClientPackage | format-table -Property path | out-string | split-path -parent | split-path -leaf | convertfrom-csv -header slot

The Output:

PS C:\Data\Scripts> $local

slot
----
001

I just need one more header called "name" that displays the name from the get-appvclientpackage output.  I want it to look like this:

slot         name
----         ---- 
001        CCleaner

If anyone can help me out it would be much appreciated.  I have tried several things but they aren't working out.

Thanks guys,

Rob


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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