Why there is no way to pass InitialSessionState for a remote RunspacePool? Why there is no way to pass InitialSessionState for a remote RunspacePool? powershell powershell

Why there is no way to pass InitialSessionState for a remote RunspacePool?


To add snap-ins to the ISS you use the ImportPSSnapIn method. Example:

$iss = [System.Management.Automation.Runspaces.InitialSessionState]::CreateDefault()s.ImportPSSnapIn($snapName,[ref]'') | Out-Null

The you create the runspace pool like this:

$runspacePool =    [System.Management.Automation.Runspaces.RunspaceFactory]::CreateRunspacePool($minRunspaces, $maxRunspaces, $iss, $Host)