Why can't I apply ToUpper() to an OwnerNode? Why can't I apply ToUpper() to an OwnerNode? powershell powershell

Why can't I apply ToUpper() to an OwnerNode?


ToUpper() is a string method and OwnerNode is probably not a string. Call the ToString() method before calling ToUpper().

$($Group.OwnerNode.ToString().ToUpper())


As Shay Levy already explained, OwnerNode is not a string and has thus not a method ToUpper(). You can call ToUpper() on its Name property, though:

$($Group.OwnerNode.Name.ToUpper())