I've got the following:
$WebContent = Invoke-WebRequest -Uri "URLHERE/$PCNAME" -UseDefaultCredential |
Select-Object -ExpandProperty Content
And it outputs perfectly:
Key1: sfsdfsdfsfdsfsdsfs Key2: SD:34:SD:34:SD:34 Version: 4 Timestamp: 4/13/2018 4:00:11 PM
But I need to be able to put the content of Key1 and Key2 into a variable, without the space, and accommodating the possibility of varying lengths of each key.
I was trying to use Substring($len - 83,14) to get the length of it all and parse out the exact spot of the Key, but for some reason they are changing in length and a few have cut off the key which gives a incorrect output. I probably need to get the whole line and then put into a variable everything after the ':' and ' '.
Any ideas?
$WebContent.Key1?iwrcmdlet is nice and parses things into objects for you, but it's impossible to know with certainty without more detail.irmto do that.