Having some string trouble, I can get the computer name using $env:computerName and it returns something like ABC1211. I am guessing that the ABC1211 is an object and I want to do a search. I want to search this for the characters ABC and then I need to do some other things with certs. I am having problem searching for the ABC.
I tried:
[string[]]$test = $env:computerName
to turn it into a string and then do a search within $test by:
if ($test.contains(("DEF")) {
Write-Host "Yeah"
}
else {
Write-Host "NO"
}
but its not working. Am I missing something? I am guessing this is really simple, but I'm just not getting it.