Implicit-remoting command validation mechanism

This topic contains 4 replies, has 2 voices, and was last updated by  Matt 7 months, 4 weeks ago.

  • Author
    Posts
  • #64503

    Matt
    Participant

    Recently one of our scripts has started generating the below warning:

    "WARNING: Commands available in the newly opened remote session are different than when the implicit remoting module was created. Consider recreating the module using Export-PSSession cmdlet."

    It doesn't impact the functionality of the script as far as we can tell but it isn't clear to me what the implications are. I understand the basics of implicit remoting and export/import-pssession but I'm not sure how this is determining the commands are different. Does this mean that when I start the session to the remote server and import the module the module is noticing that the remote server has modules/commands that it did not have before? There are a number of alternative theories but trying to test all of them would be a nightmare and I'm hoping someone already has the knowledge I seek. Please let me know if I can provide further clarification.

  • #64789

    Don Jones
    Keymaster

    It means something altered the state of the remote session, either adding or removing commands. Therefore, the local proxy module created by Import-Module no longer "matches," and could fail if you try to run a command that's no longer in the remote run space.

  • #64879

    Matt
    Participant

    Thanks for the information. To be clear on the order of events is that warning referencing a difference between the imported PSSession and the newly created remote session's modules as if it were noticing the remote server has extra/fewer modules than when created, or after the PSSession has been created, that is it imports all modules correctly and at some point a command is run to add/remove a module?

    Based on your explanation and the original error my assumption is the issue is that when the PSSession is imported it notices some of the commands it is importing cannot be run on the remote server or the remote server has extra modules that weren't there before.

  • #64887

    Don Jones
    Keymaster

    The purpose of the error is to let you know that whatever module was imported may not run correctly, because some of the commands which were imported no longer exist in the remote run space, or new commands have been added. This usually only happens, at least to me, when I import a module, disconnect the run space, and then reconnect to it – and something changes while I'm disconnected.

  • #64981

    Matt
    Participant

    Perfect, I appreciate the help. That clears this up for me.

You must be logged in to reply to this topic.