Skip to content

Instantly share code, notes, and snippets.

@regme
Created April 26, 2024 14:58
Show Gist options
  • Save regme/6d99bdd99644b94f575882bbcfbfe996 to your computer and use it in GitHub Desktop.
Save regme/6d99bdd99644b94f575882bbcfbfe996 to your computer and use it in GitHub Desktop.
New-PSObject
function New-PSObject {
param(
$properties
)
return New-Object psobject -Property $properties;
}
$objects =
(New-PSObject @{
Prop1=123
Prop2="Hello"
}),
(New-PSObject @{
Prop1=456
Prop2="World"
})
$objects | %{
"Prop1: $($_.Prop1) Prop2: $($_.Prop2) " | Write-Host
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment