P
P
post_ed2019-09-02 11:50:44
PowerShell
post_ed, 2019-09-02 11:50:44

PS: how to convert "System.Object[]" to type "System.String"?

Good afternoon,
how can I convert "System.Object[]" to type "System.String" in order to send it by e-mail?
below is the output of this construct:

$Events | Select $properties
        
    # TimeCreated                               Account Name                              Computer                                 
    # -----------                               ------------                              --------                                 
    # 02.09.2019 9:23:53                        userstroy                                 WSSTROY                                  
    # 30.08.2019 18:30:56                       UserFin                                   WSFIN

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sergey, 2019-09-03
@post_ed

| select-object -first 1
takes the first from Object[]
and what exactly to convert into a string you did not specify, but you yourself will figure it out having one from the array

A
azarij, 2019-09-02
@azarij

try like this:
$Events | Select $properties | out-string

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question