That’s quite vague. How do you know it is not working? What’s the situation before? What happens when you onvoke this code? What’s the situation after?
You need to use Select-Object -ExpandProperty SamAccountName; select samaccountname (or more properly Select-Object -Property SamAccountName if you use the full-form syntax) like you have there will get you the one property attached to an object, rather than just the value of the property – which is what Set-ADUser will need.
[quote quote=166951]You need to use Select-Object -ExpandProperty SamAccountName; select samaccountname (or more properly Select-Object -Property SamAccountName if you use the full-form syntax) like you have there will get you the one property attached to an object, rather than just the value of the property — which is what Set-ADUser will need.
[/quote]
Hi Joel, i think i do understand what you tell mee but i don’t know exaiclly what you mean. I replaced the code with