In order to get this star, you will need to have unlocked the [Vanish Cap], and there is no alternative to getting the star unlike previous ones that needed the special caps. Enter the mansion through the main doors, go up the stairs and into the last room on the right. Go around the bookshelf and exit via the other door into this room, putting you on a balcony with a Vanish Cap block. The next part will require you to hurry, so you might need to practice it a little bit to get the movement down right.
Once you don the Vanish Cap, you will need to get to the third floor, so rush back through the door and Wall Jump up to the ledge leading to the third floor. As soon as you get there, run over to the Boo picture and you should be able to walk through it with the Vanish Cap equipped. Note that from the Vanish block on the balcony, you can Long Jump over to the other door, so that gives you a little extra time in reaching the third floor. Once you’re through the wall, you will discover a big Mr. I behind it. Run around it until it disappears, leaving the Power Star.