Home > Powershell > [Powershell] Missing shared custom modules when using Powershell Remoting

[Powershell] Missing shared custom modules when using Powershell Remoting


In my previous post: Centralize Powershell Script (Modules) Repository, it describes on how to create a custom module and load it on any server. And like the title of this post indicated when you try to connect to a remote server using Powershell remoting, you’ll notice that the custom module is missing ( More information about Powershell Remoting ). This is  because it’s doing a double-hop, First hop is to connect to server (using Enter-PSSession or New-PSSession), next hop is to access the shared folder containing the custom module.

To solve this issue we need to Enable the Credential Service Security Provider (CredSSP) both on remote and host server.

#1 On the server wherein the powershell console instance is started you need to enable the client role.

#2 On the server wherein you want to connect remotely you need to enable server role.

#3 On the server wherein the powershell script is hosted you also need to enable the server role.

Run the following scripts (Run as Administrator):

Script for # 1:
Enable-WSManCredSSP -role Client -DelegateComputer <name of remote server> -force
Script for # 2:
Enable-WSManCredSSP -role Server -force
Script for # 3:
Enable-WSManCredSSP -role Server -force

Powershell remoting with CredSSP:

To connect either by Enter-PSSession or New-PSSession you need to supply extra argument:

$session = New-PSSession -ComputerName <name of remote server> -Authentication CredSSP -Credential Get-Credential

Since i used Get-Credential it would prompt for credential:

Update:

If it still doesn’t work, try restarting the Windows Remote Management (WS-Management) service.

In Run Type, services.msc

In the Name look for: Windows Remote Management (WS-Management), right click Restart.

Advertisements
Categories: Powershell Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: