atatschl
Goto Top

Vorhandenes AD-Attribut via PowerShell kürzen und in neues AD-Attribut schreiben

Hallo,

hab leider ein Problem.

Möchte ein bestehendes AdAttribut "employeeid" mit Substring kürzen und in das Feld "OtherPager" schreiben.

Auslesen alles kein Problem aber der letzte "Pipe-Befehl" will nicht.

Das ist bis jetzt mein PowerShell Befehl

Get-ADUser -SearchBase „....“ -Filter * -Properties * | Select -Property employeeid | -setAdUser -replace -OtherPager substring(8,6)

Danke für die Hilfe.

LG

Content-ID: 668127

Url: https://administrator.de/contentid/668127

Printed on: September 17, 2024 at 07:09 o'clock

Ted555
Solution Ted555 Sep 15, 2024 updated at 10:10:13 (UTC)
Goto Top
Get-ADUser -SearchBase "...." -Filter * -Properties employeeid | %{Set-AdUser $_.SamAccountName -replace @{'OtherPager'=$_.employeeid.substring(8,6)}}  
atatschl
atatschl Sep 15, 2024 at 12:00:56 (UTC)
Goto Top
Hallo,
@Ted555 Super danke geht!

Hab es noch erweiter!

LG Andreas