0

When i try do PS script to output first name and second name users blocked in my AD

$WHO= Search-ADAccount -Server "MYDOMAIN" -SearchScope Subtree -SearchBase "OU=BASE,OU=USERS,OU=COMPANY,DC=DOMAIN,DC=CONTROL" -LockedOut | Select-Object Name 

$KTO |Add-Content -Path {PATH FILE.CSV}

Always result is

@{Name=LAST NAME, NAME}

EX.

@{NAME=NOWAK,ADAM}

any help to remove begining of file ?

I had tried remove first 6 strings of that but not work

Mathias R. Jessen
  • 157,619
  • 12
  • 148
  • 206
  • In short: [`Select-Object`](https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/select-object) (`select`) by default returns _a `[pscustomobject]` instance_ that has the _requested properties_ - even when you're only asking for a _single_ property. To get only that property's _value_, use the `-ExpandProperty` parameter instead of the (possibly positionally implied) `-Property` parameter. See the linked duplicate for details and alternatives, notably the ability to simply use `(...).SomeProperty` – mklement0 May 12 '23 at 11:40

0 Answers0