Every department we have has a departmentnumber, so IF HR has departmentnumber 60, then a user in the HR department should have 60 set in the departmentnumber attribute. In our organisation, departmentnames and numbers will not change.
If somebody suggest a Hashtable instead, I would like a small demo to build from, because I am not that skilled with Hashtables but I can understand they sometimes can make your life easier in powershell.
It’s telling you that $Username is empty. When you run your script, you need to provide a value for it.
Also, -DepartmentNumber is not a parameter of Set-ADUser - you can see that in the help. The help also has examples if how to set properties for which there isn’t a parameter. From the docs:
I have thought that I need to add
Param(
And add a variable for the Username since it should run automated.
)
I dont mind to hardcode a lot of IF’s sentences. It is more in the area of, when I need to add an extra attribute value.
So after department,departmentnumber there will also be Division.
How do I smarten this up?