Page 1 of 1

Implicit remoting, module import errors out

Posted: Fri Aug 25, 2017 4:27 am
by jackieboy64
Product, version and build: powershell studio 2012 3.1.35
32 or 64 bit version of product: 64bit
Operating system: Windows 7 home premium
32 or 64 bit OS: 64bit

When I run the below code in Powershell Studio I get an arror while trying to import the modules. When I copy the three commands and take them to the ISE or PowerGui the commands run just fine and the module is imported. I'm totally stuck here.

Code: Select all

$cred = Import-Clixml ${env:localappdata}\creds.xml
$ADCommands = New-PSSession -ComputerName "server01.lab.mydomain.com" -Credential $cred -Authentication "Credssp"
Import-Module -PSSession $ADCommands activedirectory
ERROR: Import-Module : Failure from remote command: Import-Module -Name 'activedirectory': Het doel van een aanroep heeft een uitzondering veroorzaakt.
Globals.ps1 (7): ERROR: At Line: 7 char: 1
ERROR: + Import-Module -PSSession $ADCommands activedirectory
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : NotSpecified: (:) [Import-Module], InvalidOperationException
ERROR: + FullyQualifiedErrorId : PSRemotingTransportException,Microsoft.PowerShell.Commands.ImportModuleCommand

Re: Implicit remoting, module import errors out

Posted: Fri Aug 25, 2017 6:40 am
by davidc
What version of PowerShell ($PSVersionTable) do you have installed locally and on the remote machine? Note: PowerShell Studio 2012 is a really old version of the product and doesn't support later versions of PowerShell.

I also recommend checking the platform settings. For example, 32-bit vs 64-bit.

Re: Implicit remoting, module import errors out

Posted: Sat Aug 26, 2017 3:26 am
by jackieboy64
Hi David,

PSversion to new? I would consider that a plausible cause If it had never worked.
However it has been working before. One day I was using it the other day it spits errors at me.
Every time the (empty) progress bar shows me it's at 75% but then the error pops up.
Because I'm using the home edition it's not possible for me to install RSAT tools. So I have to
implicitly remote to the server.

I work in 64bit STA, v3 mode whenever I can but I tried all other settings too.

Here is my desktops version:
Name Value
---- -----
PSVersion 5.1.14409.1012
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1012
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

And here's my servers version:
Name Value
---- -----
PSVersion 5.1.14409.1005
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1005
CLRVersion 4.0.30319.34209
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Kind regards,

Jack

Re: Implicit remoting, module import errors out

Posted: Sat Aug 26, 2017 10:53 am
by jackieboy64
A little update on this problem,

when I build the project it runs like a charm. I'm officially confused.

Kind regards,

Jack

Re: Implicit remoting, module import errors out

Posted: Mon Aug 28, 2017 9:00 am
by davidc
In 2012, you have to make sure you use the project menu instead of the file menu. Otherwise I’m not sure why the error occurred.