Hi Guys,
I’m in Active direcotory Win server and I need to do what i ask belove. I’m no soo good with script I find this code to disable and move account
I need to do for a list of account (have .cvs list): Copy what in the Object Tab (Canonical field), paste in the Description field but like the Example:
In Description I have: “y.y”. I need to obtain: y.y + “origin” + paste what was in Object tab filed + “Disalbed xx/xx/2018”.
Get the users from your csv, although since you’re coming from a csv an import-csv would parse this better for you. If you had a .txt file then Get-Content would be the route you wanted
Get-ADUser |
Retrieve the ADUser object for the DN you imported
Move the object to the new OU, including the passthru parameter so you get some output to pass onto the disable command.
Disable-ADAccount
Disable that account
You probably want to write this out into more of a script than a one liner. This will give you greater flexibility in what to do with it. I’m writing this on the fly with no testing and not 100% what you mean by your “y.y” statements, but it will hopefully get you moving down the right path.
You could also use the import-csv rather than get-content of your csv file. But then you’d need to know what your column header is named to reference the property. But since I don’t know that I’m just assuming your csv is a single column of DNs that can be moved to a txt file.