Creating a remote runspace and adding an InitialSessionState
Hi,
I need to create a remote runspace which I normally do using the RunSpaceFactory class as follows:
Runspaces.RunspaceFactory.CreateRunspace(WSManConnectionInfo);
But for a program I'm writing at the moment, I need to import the ActiveDirectory module by setting the InitialSessionState since when I try via the Import-Module cmdlet, I get the error: "The term 'Import-Module' 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."
My problem is that it appears as if I can create the runspace with either the connection info or the InitialSessionState, but not both. How do I accomplish that? Or, what's keeping the Import-Module cmdlet from working properly. Any ideas on that?
Thanks,
Rob Tanner
Linfield College