Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Powershell script to add home folder to users in Active Directory

Status
Not open for further replies.

pmitconsulting

IS-IT--Management
Jul 29, 2012
1
US
Hello -- I have been banging my head for a while now, trying to figure out how to write a powershell script with the quest powershell extensions, which will:

1) Query AD for users in a specific OU that don't have a home folder specified.
2) For each found user, add an entry, pointing U: to \\server\share
3) Create the actual folder on the server at \\server\share\%username% with full control for administrators and modify permissions for the %username%.
4) Schedule the script to run on a 2003 SP2 Domain Controller...

I am going to go out and buy a powershell for dummies book later today, and would appreciate it (if i get a response that is) if you could annotate the solution / script with explanations. This will help me learn how pshell scripting works. A VBScript to do this may do, and I'm pretty close with one, but I'd prefer to do this in powershell, since everyone is switching to pshell scripting. Thanks in advance!
 
I don't have a box to test however:

1) get-qaduser | where homefolder $null
2) map drive U yourself to the share root then:
pipe it into a New-item u:\%username% -type directory
3) Not looked at permissions
4) Schedule it on the file server containing the share would be easier...then it is a local creation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top