Q. I'm trying to import a module from a remote PowerShell session that is a restricted endpoint but it does not work.
A. This seems to be a limitation of restricted endpoints. Normally I could perform:
Import-Module -Name ActiveDirectory -PSSession $adsess
However if the session if to a restricted endpoint the command will fail. The only workaround seems to be to import the session and then utilize the modules via the session, for example:
sess = New-PSSession -ComputerName <target> -ConfigurationName RestrictEnd -Credential $cred -Authentication Credssp
$imsess = Import-PSSession -Session $sess -AllowClobber
Get-command -module $imsess