I’m obviously replacing ‘userADname’ with a relevant AD username.
The error I’m getting is:
get-childitem : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
Looking at the documentation for Get-ChildItem (Get-Help Get-ChildItem), there are 2 parameters that can take arguments over the pipeline: Path and LiteralPath. Both will take arguments by PropertyName and Path will also take arguments by Value. This means that:
Must produce a string object to use for the Path parameter, or some other type of object that has a property named “LiteralPath” or “Path” with a string value that can be used as an argument in the Get-ChildItem command. I would recommend taking your first section of code (copied above) and pipe it to Get-Member. This will tell you what type of object is being returned along with it’s properties/methods. This should explain why “The input object cannot be bound to any parameters for the command”
Once you have determined the object type, the next step would be to make any changes necessary to the input object so it can be used by Get-ChildItem. Recommend looking a PowerShell in a Month of Lunches chapter 9 specifically 9.5 “When things don’t line up: custom properties” for an explanation.
I piped to get-member and saw that there was numerous types of information being returned, so I’m thinking that I need to tell it to specifically look at the HomeDirectory info?
This isn’t data that get-childitem can handle, get-childitem is looking for a unc path i.e \server\testuser NOT that outputted object you see above. You can get what you need two different ways