ncomper
asked on
Powershell script to set existing users Homedirectory based on inputfile
Hi All
I have a list of users that have not got a home directory set, I have all the samaccountname in a CSV file,
I would like to use this as an input file to set the Home directory to use the H drive and be \\domain.com\userprofiles\ %username% \Home
Is anyone able to help me out with a script to do that.
Thanks
I have a list of users that have not got a home directory set, I have all the samaccountname in a CSV file,
I would like to use this as an input file to set the Home directory to use the H drive and be \\domain.com\userprofiles\
Is anyone able to help me out with a script to do that.
Thanks
ASKER
Thanks, that works but configures the local path section of the Home Folder
However I would like it to use the connect section where we choose a drive letter and specify the UNC path in the To field
Thanks
However I would like it to use the connect section where we choose a drive letter and specify the UNC path in the To field
Thanks
Add parameter -homedrive "X:"
Import-Csv C:\users.csv | % {
Set-aduser $_.username -homedirectory "\\domain.com\userprofiles\$($_.username)\Home" -homedrive "X:"
}
ASKER
I managed to get it working using the following
However I noticed it does not actually create the folder which if you do in the GUI it does.
Is there something I am missing?
Thanks
Import-Csv C:\scripts\users.csv | % {Set-aduser -HomeDrive 'H:' $_.username -homedirectory "\\2008dc01\homefolders\$($_.username)"}
However I noticed it does not actually create the folder which if you do in the GUI it does.
Is there something I am missing?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, ill take a look, seems as though to get the permissions sorted is fairly complex
ASKER
Thanks
Open in new window
Input csv format..Open in new window