5 Replies Latest reply on Sep 21, 2011 4:40 PM by DennieTidwell

    Get-XmlNode syntax works in one script but not another.

    dawoo Hot Shot



      I've extracted some script from two of the highly respected PowerCLI gurus, messers Alan Renouf & LucD.


      I'm using the PowerGUI environment and find one script completes successfully and one doesn't. They perform different tasks but I'm keen to understand the syntax error I'm receiving.


      Both contain the 4 lines:

        function Get-XmlNode{

        param ($path)




      In my 1st script I receive the error "Method invocation failed because http://System.String doesn't contain a method names 'SelectNodes'.

      In my  2nd script the same lines complete succesfully. I've used the Debug feature to trace the message and scripting halt too.


      Script 1, Export vCenter permissions ready for the import script : From Alan Renouf

      Script 2, vProfile dump of your hosts, virtual machines etc... : From LucD (the variable $entity will need to reflect a valid cluster name)


      It seems to me the message is attempting to say "I don't have knowledge of the parameter you've supplied".


      I've attached both scripts if anyone has a moment to review.


      Many thanks,