I need to make a script that goes through all members of the Domain Users group and puts them into an array so I can do a for each and create a new folder in \fileserver\users$username\Documents called MFA then drop files into it…
$username has to be their login ID so I think the samaccount value will do this…
I need something like this to get all the users
$users = Get-ADUser -Filter * -SearchBase “OU=Domain Users” | select samaccountname
Is this correct??
Then I want to do something like:
for each user in $users
cd \fileserver\users$username\Documents
mkdir MFA
cd \fileserver\users$username\Documents\MFA
copy files into MFA
next
It’s getting the users into an array containing their login ID, which I think is their samaccount name
First … please … when you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
I do know how to format code on this forum…real code, that is.
What I posted was mostly air code, very general stuff.
Which I didn’t think was also required to be pre-formatted.
Meanwhile thank you for helping me get started!!
Thank you, Tom
You may think of it as a way to be polite with the people willing to help you and make it easier for them to read your question and to easily destinct between text and code.