Probably the best way is to switch from calling the object methods directly to using the cmdlets. Back in the day, there weren't proper cmdlets for this, but they've been available for quite a while now, and using the cmdlets will almost always be more compatible across version than calling the object methods directly, since object methods can potentially change any time, even between updates. The following code should work from at least v7 all the way through 9.5U3 without any changes: