Solved

Powershell Remote With Remote Module

Posted on 2013-01-21
2
725 Views
Last Modified: 2013-01-22
I have a server that I ran Enable-PSRemoting on successfully.  

I am able to run Enter-PSSession <computername> from my local workstation and successfully connect.

I need to somehow import a module from the remote server into the session I am using and be able to use cmdlets from that module.  I don't want to have to import the module locally.

Is that even possible?
0
Comment
Question by:jonathanbyers
2 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 350 total points
ID: 38803515
Try this..
$Session = New-PSSession "ServerName"
Invoke-Command -Session $Session {Import-Module RemoteDesktopServices}
Invoke-Command -Session $Session {Get-PSDrive}

Open in new window

0
 
LVL 69

Assisted Solution

by:Qlemo
Qlemo earned 150 total points
ID: 38804398
You can also combine the complete script into a single block, which is usually more straight-forward (I'm using the same lines as Subsun as an example):
$Session = New-PSSession "ServerName"
Invoke-Command -Session $Session {
  Import-Module RemoteDesktopServices
  Get-PSDrive
}

Open in new window

0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help you understand what HashTables are and how to use them in PowerShell.
While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question