I have made a function that returns a custom psobject, but when I am trying to use the "." to get the properties of the object noting happens, also the pipe isnt working in this type of object.
There is a way to convert this object to the one that is created with the cmdlet New-object?
Why the new psobject have missing features?
$ObjectProperties = @{
Users = "admin"
Computer = "localhost"
Error = $false
}
$Objects += New-Object psobject -Property $ObjectProperties
# I am trying to use select this object like $objects.computer but doesnt work
$Objects.
$objectTest = New-Object Object
$objectTest | Add-Member NoteProperty error $false
$objectTest | Add-Member NoteProperty Computadores "localhost"
$objectTest | Add-Member NoteProperty Usuarios "admin"
#I need an object like this that can be easy managed
$objectTest
I have tried converting it in this way but doesn't work
$objectCompu = $objects |select computer|Out-String
$objectError = $Objects |select error|Out-String
$objectUsers = $Objects |select users |Out-String
$objectTest = New-Object Object
$objectTest | Add-Member NoteProperty error $objectError
$objectTest | Add-Member NoteProperty Computadores $objectCompu
$objectTest | Add-Member NoteProperty Usuarios $objectUsers
$objectTest
$Objects +=instead of$Objects =? - TessellatingHeckler