I need a single powershell script combining ad-computer + get-user to get the missing user attribute. I dont now how to combine the two classed into one script.
The Computer object attribute: "extensionattribute1" already has the Username in it, and i need to add the "physicalDeliveryOfficeName" to the computer attrbiute:
extensionattribute2.
Something like:
get-adcomputer COMPUTER1 -Properties Name,extensionattribute1 | select Name,extensionattribute1,(IN HERE I WOULD NEED THE QUERY FOR USER ATTRIBUTE "physicalDeliveryOfficeName")
set-ADComputer -Replace @{extensionAttribute2 = "$($_.physicalDeliveryOfficeName)"}
I have seen this for the Manager attribute. I would need the "physicalDeliveryOfficeName":
@{n='Manager';e={(Get-ADUser $_.Manager).Name}}
I need to combine these parts together into one script so i can write the location into the empty computer attribute extensionattribute2.
Computer Object: NOW:
name,extensionattribute1,extensionattribute2
PC1,John Doe,"NOT SET"
NEEDED:
name,extensionattribute1,extensionattribute2
PC1,John Doe,Office location xyz
Thanks in advance