Verify Computer is in the correct OU and turn Excel cell green.

Hi there. I’m still sort of new to complicated powershell scripting and this is one I’ve been beating my head against the wall on. I have a script running now that pulls a list of PCs from a CSV file and loops through a list of check. One of the checks hits Active Directory and dumps the result out to Excel (not CSV).

What I would like to do is turn that Excel cell green if it matches the correct OU but then red if its not in the right OU. I dont have to see the full OU in the cell like I do now. If it is easier to just change the cell to read “correct” or “incorrect” that would be fine too.

Anyone have any ideas?

We are barely able to help without seeing your code or knowing your environment. So you will have to help us helping you. Show your code please. (formatted as code please :wink: )

…and all this time I’ve believed in Olafs omniscience

You must have mistaken me for someone else. :wink: I even try to avoid to guess for someone if I don’t know him or her.

Its possible to change the cell color, but like @olaf-soyk mentioned, it will be good if you can show your code or a similar sample code. It will help us to help you. You can have a look at below blog post as well.