pscustomobject Questions
4
Solved
I am working with deeply nested JSON and, after convertfrom-json, need to be able to traverse through various parts of the object which the convertfrom-json cmdlet generates.
I have no way of knowi...
Shinleaf asked 3/10, 2020 at 17:26
4
Solved
Some hashtables in PowerShell, such as those imported with Import-PowerShellDataFile, would be much easier to navigate if being a PSCustomObject instead.
@{
AllNodes = @(
@{
NodeName = 'SRV1'
R...
Buskirk asked 29/9, 2022 at 10:35
10
Solved
What is the easiest way to convert a PSCustomObject to a Hashtable? It displays just like one with the splat operator, curly braces and what appear to be key value pairs. When I try to cast it to [...
Spinous asked 18/9, 2010 at 2:22
3
Solved
Is there a neat way to convert a PSCustomObject to a custom class as a function parameter in PowerShell 5.1?
The custom object contains additional properties.
I'd like to be able to do something l...
Mong asked 10/10, 2019 at 19:54
2
Solved
I've been using PowerShell for a number of years, and I thought I had a handle on some of its more 'eccentric' behaviour, but I've hit an issue I can't make head nor tail of...
I've always used "r...
Staceystaci asked 4/7, 2018 at 16:29
3
I feel silly that I cannot figure this out, but say I have an array containing pscustomobjects. At an incredibly high level take the following example:
$arr = @()
$obj1 = [pscustomobject]@{prop1=&q...
Interpreter asked 19/7, 2021 at 22:4
2
Solved
I'm trying to understand why PowerShell's memory balloons so much when I import a file that's ~16MB's as a variable. I can understand there's additional memory structure around that variable but I'...
Cochleate asked 22/2, 2020 at 15:30
9
Solved
First, as this leads to my question, I'll start by noting that I've worked with XML a fair bit in PowerShell, and like how I can read data from XML files, quickly, into arrays of custom objects. Fo...
Inexplicit asked 27/6, 2013 at 21:48
2
Solved
Say I have a PowerShell array $Sessions = @() which I am going to fill with PSCustomObjects. How can I add a custom property to the array itself? E.g. so I can have $Sessions.Count which is built-i...
Anglican asked 11/9, 2017 at 11:39
2
Solved
In PowerShell v3.0 PSCustomObject was introduced. It's like PSObject, but better. Among other improvements (e.g. property order being preserved), creating object from hashtable is simplified:
[PSC...
Kyphosis asked 9/3, 2016 at 14:25
1
Solved
Reading through an Article about custom Objects:
http://technet.microsoft.com/en-us/library/ff730946.aspx
I wonder why i get a result for the individual entry: e.g $objAverage.Name
while by $col...
Priority asked 28/4, 2011 at 15:29
4
Solved
The following code gives me an array of PSCustomObjects, how can I get it to return an array of Strings?
$files = Get-ChildItem $directory -Recurse | Select-Object FullName | Where-Object {!($_.ps...
Nora asked 6/3, 2009 at 12:49
1
© 2022 - 2025 — McMap. All rights reserved.