none
Setting Home Folder Drive letter for all users. RRS feed

  • Question

  • Hello Scripting Guys. I have been tasked with making sure that all of the Home Folder Drive letters are the same for every user. After research online I have found the following script I tested on myself.

    Set-ADUser richard -HomeDirectory $_.HomeDirectory -HomeDrive "K:" 

    The problem with this script is that it cleared the home folder drive letter and path.

    If I can figure this part out a simple for each statement will allow me to replicate it for all the users.

    There is something I am missing, any help would be appreciated.

    Richard

    Tuesday, September 13, 2016 3:19 PM

Answers

  • I have suggested that to my boss but they want to do it via script. They want to be able to target individuals and OU's.

    That being said I have been toying around with the script and this is what I have that works.

    
    get-aduser richard | Set-ADUser -HomeDrive H:
    If I put this in a for each statement and change my name with a variable it will do what they need it to. Thanks all. Richard

    • Marked as answer by Richardlaw Tuesday, September 13, 2016 4:16 PM
    Tuesday, September 13, 2016 4:16 PM

All replies

  • Hi,

    Use Group Policy for this, don't script it.


    Tuesday, September 13, 2016 3:20 PM
  • I have suggested that to my boss but they want to do it via script. They want to be able to target individuals and OU's.

    That being said I have been toying around with the script and this is what I have that works.

    
    get-aduser richard | Set-ADUser -HomeDrive H:
    If I put this in a for each statement and change my name with a variable it will do what they need it to. Thanks all. Richard

    • Marked as answer by Richardlaw Tuesday, September 13, 2016 4:16 PM
    Tuesday, September 13, 2016 4:16 PM
  • Group Policy can easily target individuals and OUs, but whatever floats your boat.

    Tuesday, September 13, 2016 4:24 PM
  • The boss is the boss, I don't have a say in it this time.
    Tuesday, September 13, 2016 6:21 PM