Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Cannot Convert type

$
0
0

I am attempting to pull the manager of a user from AD and then from there pull a list of that mangers direct reports (users 1's peers).

$a = Get-ADUser user1 -Properties Manager | select Manager gives me:

Manager

------------

CN=Zipper\, Long  [B000000],OU=Users,OU=CBS,OU=Sites,DC=XXXX,DC=BBBBBBB,DC=ORG

Now when I run:

Get-ADUser $a -Properties directReports | select -Expand directReports

I get the error message:

Get-ADUser : Cannot bind parameter 'Identity'. Cannot convert the "@{Manager=CN=Zipper\, Long  [B000000],OU=Users,OU=CBS,OU=Sites,DC=XXXX,DC=BBBBBBB,DC=ORG}" value of type "Selected.Microsoft.ActiveDirectory.Management.ADUser" to type "Microsoft.ActiveDirectory.Management.ADUser".

I've tried the Trim methods but get an error that there isn't a method of that name. I've tried writing it to a text file and using Get-Content but same no Trim method error.  Ideally I'd like to extract just the 'B000000' for use.

Thanks in advance .


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>