New PSSessionCustom - PPOSHGROUP/PPoShTools GitHub Wiki

New-PSSessionCustom

PPoShTools -> New-PSSessionCustom.ps1

Synopsis

Creates PS Session object depends on parameters passed

Syntax

New-PSSessionCustom [-ComputerName] <String> [[-Credential] <PSCredential>] 
[[-ConfigurationName] <String>] [[-SessionName] <String>] [<CommonParameters>]

Description

Accepts ComputerName, Credentials and ConfigurationName as parameters to create PS Session. If no credentials are given, current credentials are used.

Parameters

-ComputerName<String>

Computer name of the nodes where the PS Session will be established.

  • PipelineInput: false
  • Required: true

-Credential<PSCredential>

A PSCredential object that will be used when opening a remoting session to any of the $Nodes specified.

  • PipelineInput: false
  • Required: false

-ConfigurationName<String>

PowerShell Configuration name to use (JEA).

  • PipelineInput: false
  • Required: false

-SessionName<String>

Custom Name for PSSession

  • PipelineInput: false
  • Required: false

Examples

Example 1

New-PSSessionCustom -ComputerName 'SomeServer' -Credential (Get-Credential) -SessionName

Will use {SomeDomain\SomeUser} to create PSSession to computer {SomeServer} Created PSSession to computer {SomeServer}

Id Name            ComputerName    ComputerType    State         ConfigurationName     Availability
-- ----            ------------    ------------    -----         -----------------     ------------
5 WinRM5          SomeServer      RemoteMachine   Opened        Microsoft.PowerShell     Available
⚠️ **GitHub.com Fallback** ⚠️