One creature within range that you can see must make a Wisdom saving throw. On a failed saving throw, you learn any vulnerabilities and resistances the creature has and the DM must give truthful information.
Vulnerabilities include anything that causes the creature more than the normal amount of damage.
Resistances include any effects that reduce or negate damage the creature takes and immunities to particular attacks.
The spell also identifies resistances and vulnerabilities granted by spell effects like fire shield.
For example, if cast upon an iron golem, you learn that it has immunity to fire, poison, psychic damage and bludgeoning, piercing and slashing damage from nonmagical weapons that aren't adamantine, that it is immune to any spell or effect that would alter its form.
If cast upon a balor, you learn that it has resistance to cold, lightning damage and bludgeoning, piercing and slashing damage from nonmagical weapons, and is immune to fire and poison