regexpowershellappv

Using Regex to find String in Powershell Output


I'm using this command on Powershell

Get-AppvClientPackage -Name $UserInput* 

which gives me the following output on the console

PackageId            : 6f02c6ed-0bd6-4df7-997c-73b5966d7a58
VersionId            : d6312052-0d90-4214-995b-da0461ace493
Name                 : FastStone Image Viewer 5.5
Version              : 0.0.0.1

I'm trying to use Select-String to put the PackageId into a variable, similar to this

$PackageGUID = Select-String ....

Is that even possible with a console-output? If so, what would the RegEx have to look like to find the GUID?

Thanks for your help


Solution

  • with the select-object cmdlet or its alias select you can get specific properties...

    I cant test it, but something like this should work

    $a = Get-AppvClientPackage -Name $UserInput* | select -expand PackageId