EvotecIT / PSTeams

PSTeams is a PowerShell Module working on Windows / Linux and Mac. It allows sending notifications to Microsoft Teams via WebHook Notifications. It's pretty flexible and provides a bunch of options. Initially, it only supported one sort of Team Cards but since version 2.X.X it supports Adaptive Cards, Hero Cards, List Cards, and Thumbnail Cards. All those new cards have their own cmdlets and the old version of creating Teams Cards stays as-is for compatibility reasons.
MIT License
409 stars 41 forks source link

Show Get-Content is value #25

Closed neroxyr closed 3 years ago

neroxyr commented 3 years ago

I have a file that I want to be shown in the value parameter $CreatedUsers = Get-Content C:\Logs\AAD_creacionexito.txt | Foreach {"$(($ -split '\s+',4)[0..0])"} $Fact12 = New-TeamsFact -Name 'Correos creados' -Value "$CreatedUsers"

The file hasta a mail in each row and when it is shown in Teams its displayed as one line

PrzemyslawKlys commented 3 years ago

I don't fully understand but I guess you need to do:

$CreatedUsers = Get-Content C:\Logs\AAD_creacion_exito.txt | Foreach {"$(($_ -split '\s+',4)[0..0])"}
foreach ($User in $CreatedUsers) {
 New-TeamsFact -Name 'Correos creados' -Value "$User"
}

At least I think so, but you haven't given much to go on.

neroxyr commented 3 years ago

Thanks for your quick reply. It is indeed what I was trying to say.

What I get from $Fact12 when put in the -ActivityDetails $Fact12 it shows me this:

Correos creados | creacion.prueba1 creacion.prueba2 creacion.prueba3 creacion.prueba4 creacion.prueba5.

image

In your script It will show me this: Correos creados creacion.prueba1 Correos creados creacion.prueba2 Correos creados creacion.prueba3 ..... Is there a way to use the same Fact variable to put in the -ActivityDetails parameter or how do I call it to be present in the New-TeamsSection?

PrzemyslawKlys commented 3 years ago

I am not really sure what you're asking. You're mixing a bit too Spanish and English for me. You can use the same data as with anything really. Variables are visible within it's scope.