Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: PsObject in a String

$
0
0

You can loop through the elements of the $Object.Server array and write them individually to the log. That would post several event-32s in the log.

Alternatively, you can create a temp string variable and concatenate the $Object.Server array elements into it, and use it in your write-eventlog statement. Something like:

$Temp = $null; ForEach ($Item in $Object.Server) {$Temp += [string]$Item + " -"}
write-eventlog -computername $env:COMPUTERNAME -logname Application -source esent -eventID 103 -message "Check Status of $Temp Status $Object.PortOpen"

Can you post printout of how your $Object looks like?
Type in

$Object | Select *

and post the output here please..


Viewing all articles
Browse latest Browse all 13067

Trending Articles