Auto-generate optimal direction for Unity Raycast with specifications

How can I have a Physics.Raycast auto-generate a direction for itself to try to hit a given target through a restricted window of space?

[Update]

After much work, my problem has slightly morphed into one about mesh colliders: given a (convex) mesh collider, how can I detect all of the points intersecting with the collider? Or, if this can be done easily, can I get one Vector3 per object that is within the mesh collider?

[/Update]

This is kind of a long question, so I'll try to explain it the best I can:

1. I have 3 GameObjects: a source, a target, and a "window". This window sits between the source and target.
2. I want the source to make a raycast that points in the direction of the target (not necessarily it's transform.position, just a direction that will make it hit the target) and this raycast must pass through (collide and continue through) the window GameObject
3. I would like to automatically generate this direction for the raycast to follow such that #2 happens
4. I would like this algorithm to also recognize if the above is not possible
5. As an added item, I would like this raycast to pass through (collide and continue through) any objects that may be in it's way between it and the window

Here's an image describing my issue in more detail:

How can I accomplish this?