Hello, I am trying to get 1 piece of information from a string. I run a command it gives me the below information. SubString() does not work on this for some reason. I have dumped the below to a .TXT file and used Get-Content and SubString() fails.
Hi and welcome to the forum. Please when posting code or errors, please format it as code with the preformatted button <\>. Simply click that button and paste the code. You can see your double quotes have been converted to some fancy quotes that will cause errors if copy/pasted into powershell.
I can tell you how to extract the value, but first I’d be interested in seeing how you retrieve the value initially. There is likely a better/easier way to extract the value without resorting to string manipulation.
Hello, thank you for the quick reply. Unfortunately wrapping everything in () does not work. The TAG can’t be called by itself and the only way to get that number is to tweak the string.
And way more precise than string manipulation. However, to answer that question, assuming it’s a single string, here are several methods to manipulate the tag out of the string.
Also, please take the time when posting in the forum, to format code as code. There’s a little button up top that looks like </> - simply click it and paste the code in the highlighted area.