0

In powershell , for a complicated reason an application needs a 6 character string as a sort of handle (Eg: abcdef) for a long asynchronous operation. I perform this using

$replaceHandle = "abcdef"
start-Job -handle $replaceHandle

The application stores the status of the asynchronous job in $abcdef (Prefixes string with $) and i can access parameters of job Status at any time by requesting

Get-Status -ID $abcdef.ID

Problem for me in my code is i am not able to get this $abcdef.ID properly I have tried $($jobVar.ToString()).ID - this gives blank/errors out maipulating $$jobVar.ID actually gives $'abcdef'.ID

How do i manage to get value of ($abcdef.ID) appropriately ?

2 Answers 2

2

It because $jobVar is first interpreted :

try :

write-host "the value is $($jobVar.ID)"
Sign up to request clarification or add additional context in comments.

Comments

0

(Get-Variable $b -ValueOnly).Id

This worked

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.