# Implicit remoting problem

**URL:** <https://forums.powershell.org/t/implicit-remoting-problem/7860>\
**Category:** PowerShell Help\
**Created:** [January 14, 2017, 10:56pm UTC](https://forums.powershell.org/t/implicit-remoting-problem/7860 "2017-01-14T22:56:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian-clanton](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@brian-clanton](https://forums.powershell.org/u/brian-clanton)\
**Post date:** [January 14, 2017, 10:56pm UTC](https://forums.powershell.org/t/implicit-remoting-problem/7860/1 "2017-01-14T22:56:09Z")

</div>

I am composing a script that will run on a domain controller (windows 2008 R2) checking OU user names but then going out to the users H: drive and checking permissions, both for the root folder and the users folder.

The share permission portion of the script, I would prefer to use Get-SMBShare as opposed to working with WmI. However, my script is running on Windows 2008, so I decided to use implicit remoting to import the modules I need from a Windows 2012 server to run the necessary commands I need.

I used this site as a guide.  
[Windows PowerShell: Implicit Remoting](https://technet.microsoft.com/en-us/library/ff720181.aspx)

Here are my commands (from the desktop of the windows 2008 Server, logged on with domain admin credentials):

```
$session = New-PSSession -ComputerName w12-r12-01V
invoke-command {import-module smbshare} -session $session
Export-PSSession -Session $session -CommandName *-SMB* -OutputModule RemSMB -AllowClobber

    Directory: X:\Users\administrator.XXXX\Documents\WindowsPowerShell\Modules\RemSMB

Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 1/14/2017 10:03 PM 99 RemSMB.format.ps1xml
-a---- 1/14/2017 10:03 PM 576 RemSMB.psd1
-a---- 1/14/2017 10:03 PM 96492 RemSMB.psm1

Remove-PSSession -Session $session
```

Then, when I try to import, the invoke method portion fails… I was successfully able to do an implicit remote using the ‘activedirectory’ module as the example, but ‘SMBShare’ module is failing.  
Is this possible with SMBSHARE module?

```
PS C:\Users\administrator.XXXX> Import-Module RemSMB -prefix Rem
Cannot invoke method. Method invocation is supported only on core types in this language mode.
At C:\Users\administrator.XXXXXXX\Documents\WindowsPowerShell\Modules\RemSMB\RemSMB.psm1:22 char:1
+ $script:WriteHost = $executionContext.InvokeCommand.GetCommand('Write ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodInvocationNotSupportedInConstrainedLanguage

Cannot invoke method. Method invocation is supported only on core types in this language mode.
At C:\Users\administrator.XXXXXXX\Documents\WindowsPowerShell\Modules\RemSMB\RemSMB.psm1:23 char:1
+ $script:WriteWarning = $executionContext.InvokeCommand.GetCommand('Wr ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodInvocationNotSupportedInConstrainedLanguage

Cannot invoke method. Method invocation is supported only on core types in this language mode.
At C:\Users\administrator.XXXXXXX\Documents\WindowsPowerShell\Modules\RemSMB\RemSMB.psm1:24 char:1
+ $script:WriteInformation = $executionContext.InvokeCommand.GetCommand ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodInvocationNotSupportedInConstrainedLanguage

Cannot invoke method. Method invocation is supported only on core types in this language mode.
At C:\Users\administrator.XXXXXXX\Documents\WindowsPowerShell\Modules\RemSMB\RemSMB.psm1:25 char:1
+ $script:GetPSSession = $executionContext.InvokeCommand.GetCommand('Ge ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodInvocationNotSupportedInConstrainedLanguage

Cannot invoke method. Method invocation is supported only on core types in this language mode.
At C:\Users\administrator.XXXXXXX\Documents\WindowsPowerShell\Modules\RemSMB\RemSMB.psm1:26 char:1
+ $script:NewPSSession = $executionContext.InvokeCommand.GetCommand('Ne ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodInvocationNotSupportedInConstrainedLanguage
```

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [January 26, 2017, 11:36am UTC](https://forums.powershell.org/t/implicit-remoting-problem/7860/2 "2017-01-26T11:36:10Z")

</div>

The problem is that the objects delivered by implicit remoting aren’t live. That means they lack methods, and The SMB module needs those. It’s really just wrapping CIM/WMI. So it won’t work well implicitly.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:39pm UTC](https://forums.powershell.org/t/implicit-remoting-problem/7860/3 "2024-05-16T20:39:21Z")

</div>


