I'm trying to extract the key for a user but I get unwanted spaces and newlines before the string and after it. My script is the following:
$File = gwmi Win32_UserProfile -co MADS000001 |
select localpath, sid |
Where-Object {$_.localpath -eq "C:\Users\Administrator"} |
select Sid |
ft -HideTableHeaders |
Out-String -Stream
Write-Host $file
How can I get rid of them?
The output looks like this:
