Question:
How would I delete the first line in the output from this command? If the output is A123456
, I just want it to show me 123456
with the A
.
1 2 |
Get-User $_ | Select sAMAccountName |
Answer:
Just get the substring starting at the second letter(index 1).
1 2 |
Get-User $_ | Select @{n="AccountName";e={$_.sAMAccountName.Substring(1)}} |
If you just need the value, you could do it like this:
1 2 |
Get-User $_ | % { $_.sAMAccountName.Substring(1) } |