Hi,
I'm written a script to get back some Ts profile information from Users' AD Account. The script is great but depends on some hardcoded values. What I would like to do is get the users CN and OU from the accounts distinguished name. So far I have the below (bear with with me as its pretty clunky)
$Values= ($AccountName.DistinguishedName).Split(",") $AccDN = $Values[0]+","+$Values[1]
$AccDN gives me the user part of the DN, however I then want to spin the rest of the string off into its own variable which I can then reuse (say $OUDN), however i'm unable to serach the string for the contents of the variable ($AccDN) and then remove it.
Can this be done or is there a better way?