Solved

Powershell Remote With Remote Module

Posted on 2013-01-21
2
697 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
Comment Utility
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 68

Assisted Solution

by:Qlemo
Qlemo earned 150 total points
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
OfficeMate Freezes on login or does not load after login credentials are input.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now