adamtrask
asked on
Moving users inside active directory using powerShell command
Good morning experts,
I am trying to learn all that I can PowerShell for active directory by asking questions since I can not find a book on the topic:
Presently, I need to know (in the simplest command possible) how to move one user from an Active Directory folder to another. Say I need to move a disabled user to a folder called DisabledUsers.
I looked for a "move" command but did not find one. Therefore, I am assuming that this has to be done in two stages, first copy the user to DisabledUsers and then remove him/her from wherever they are. Am I correct in this assumption?
Please advise with an example. Thanks.
I am trying to learn all that I can PowerShell for active directory by asking questions since I can not find a book on the topic:
Presently, I need to know (in the simplest command possible) how to move one user from an Active Directory folder to another. Say I need to move a disabled user to a folder called DisabledUsers.
I looked for a "move" command but did not find one. Therefore, I am assuming that this has to be done in two stages, first copy the user to DisabledUsers and then remove him/her from wherever they are. Am I correct in this assumption?
Please advise with an example. Thanks.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for adamtrask's comment #a40694785
for the following reason:
Thank you very much. That's what I needed. I am sorry if my questions are not as succinct as they should be, but that is because I am a new hand trying to grasp too many things at the same time.
Thanks a lot
Accepted answer: 0 points for adamtrask's comment #a40694785
for the following reason:
Thank you very much. That's what I needed. I am sorry if my questions are not as succinct as they should be, but that is because I am a new hand trying to grasp too many things at the same time.
Thanks a lot
Guest and krbtgt are system defined users default is set to disabled and should not be touched.
ASKER
Thank you both... I am not sure what I did to generate the request to close the question
ASKER
Thank you again
ASKER
I am having difficulty understanding the job of the if statement in the foreach loop:
if ( !($disableduser.SamAccount
Translating the above to plain English it tells me the following: if the disabled user's samAccountName is not the same as "guest" and if that name is different from "krbtgt" then the moving process begins.
What does "Guest" and "krbtgt" represent... ?
Thanks