[blockquote]The term ‘Get-RDUserSession’ is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
+ CategoryInfo : ObjectNotFound: (Get-RDUserSession:String) , C
ommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
+ PSComputerName : MyServer [/blockquote]
Can someone please help me out here and explain why I cannot use Implicit Remoting and run this command?
You removed the session. You can’t do that. The session is needed to run all of the commands on the remote computer. The module you created locally only contains shortcuts to the remote computer, which rely on the original session object. That’s why it’s called “Remoting.”
So were you mistaken here in this article back in 2010, or am I just not reading this correctly?
I thought I could remove the session as long as I imported the remote system’s cmdlets into my PowerShell profile on my local system and then import that module?
By the way, I commented out the “Remove-PSSession -Session $RemSession” and it still produced the same following error:
[blockquote]The term ‘Get-RDUserSession’ is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
+ CategoryInfo : ObjectNotFound: (Get-RDUserSession:String) , C
ommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
+ PSComputerName : MyServer[/blockquote]
You’ve got an extra step in there that isn’t mentioned in the article you referenced; Enter-PSSession is unnecessary, and will probably screw with your results.
The article is going about it slightly differently. In a perfect world, disconnecting the session and then attempting to use the module should re-connect the session implicitly. However, keep in mind that the article is four years old, and was written for an older version of PowerShell than you’re likely using. The article uses PowerShell v2; things work slightly differently in v3+.
Today, it would be more sensible to use the shorter version: