r/PowerShell • u/Arnoc_ • Dec 11 '25
Powershell - Extract Values from Singleline Value
Our Help Desk Service at work has an API and a PowerShell module for it to make calling the API easy.
Goal want to accomplish is to pull information from New Hire Tickets directly into script we have for creating accounts, so that there is no potential for user error from our Help Desk tech side manually entering in account details to a ticket.
I can call up the details of a ticket via powershell, and it returns a single line value that's formatted as such:
custom_fields
-------------
@{first_name=Value; middle_name_not_required=; last_name=' title; ...
eventually ending in a } of course.
I don't know PowerShell well enough to know the correct names of stuff to know how to formulate my question properly.
But from what I can tell, that is a single-line output. I'd like it to be stored so I could call a specific value from it, such as say: $customVariable.first_name to get the first_name value from it.
I've tried for instance to store the contents from the ticket in a variable named $custom
Then tried to do:
$string = $custom.Split(";")
But that returns:
Method invocation failed because [Selected.System.Management.Automation.PSCustomObject] does not contain a method named 'Split'.
Any suggestions on what to do?
View all comments
Show parent comment
1
u/Arnoc_ Dec 11 '25
Thank you! Looking at the output I thought for sure I'd be able to target it like that. I've just never had need or messed with custom objects before. My first attempt was:
$custom = ... | select custom_fields$custom.first_nameAnd got errors. Which is what led me down to thinking it was a string and looking up .split and such.
I had started with some lines of trying to do -expandproperty but that was after I defined the variable.
I truly appreciate it!