?
Solved

Powershell Remote With Remote Module

Posted on 2013-01-21
2
Medium Priority
?
741 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 1400 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 70

Assisted Solution

by:Qlemo
Qlemo earned 600 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
Suggested Courses

777 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