+menu-


Remoting examples from my presentation

Example #1

#Sessions

#Single Session
$Session = New-PSSession -ComputerName "computername"


#Multiple Sessions

$Session = New-PSSession -ComputerName "comp1","comp2".....

#Remove all Sessions

Remove-PSSession *

#Remove Named Session

Remove-PSSession $Session

#Using $session
Invoke-Command {ipconfig} -Session $Session

Enter-PSSession -Session $session
[/sourcecode]

Example #2

1
$session = New-PSSession -ComputerName "compname"

Invoke-Command {Import-Module ActiveDirectory} -Session $session

Import-PSSession -Session $session -Module ActiveDirectory -Prefix "ctn"



notepad (Get-Module).path


Get-Command *ctn*

One Response to Remoting examples from my presentation

  1. Pingback: Wrapping up Minasi Conference 2010 «