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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AD HomeDirectory Help!

Status
Not open for further replies.

DarkOne72

Technical User
Jun 14, 2002
208
0
0
US
I am writing a script to pull all the users who has a homedirectory on a certain server using a wild card. It runs and no errors but it exports nothing and doesn't run long.
Any assistance would be appreciated:

Code:
$csvfile = "C:\Scripts\Home-Dir-Lookup.csv"

Get-QADUser -SizeLimit 0 -SearchRoot "ou=Ccntr-J,OU=Region Coastal,OU=Central Division,DC=home,DC=com,DC=com" -HomeDirectory *'
-ObjectAttributes @{homeDirectory='\\fla*'} -IncludeAllProperties |'
Select-Object LogonName,HomeDirectory |
Export-Csv $csvfile
 
I'm not well versed at powershell but looking at your syntax it looks like you made a possible typo.It should be DC=home , dc=com not DC=home, dc=com , dc=com.There could be something else but I caught that possible error while reading your script.
 
I have removed the second dc=com and receive
+ CategoryInfo : NotSpecified: :)) [Get-QADUser], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Quest.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.GetUserCmdlet
 
First I would try running that command in segments in my console window, to see if you get any output.

Break it down:

Get-QADUser -SizeLimit 0 -SearchRoot "ou=Ccntr-J,OU=Region Coastal,OU=Central Division,DC=home,DC=com,DC=com"

If you don't get all of the users in the Cost-Center-J OU here, Stop and fix the errors. I think your formatting looks strange on the OU name. Try changing the DC=Home to OU=Home. You only use DC= for your the name of the domain.

Furthermore, if you're having trouble on the formatting of your Distinguished Names for your OU's, try this, replacing the text in -like "Your_OU_name_Here" with the OU you want.

get-qadobject -Type 'organizationalUnit' | ? {$_.Name -like "Your_OU_Name_Here*"}

You can copy the output from this to get the correct formatting of your OU's Distinguished Name.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top