Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Get-PSSessionConfiguration cmdlet.
What can I do with it?
Session configurations determine the settings used by remote PowerShell sessions to that computer. This cmdlet displays the settings for the current configuration(s) used on the local computer.
Example:
Retrieve the settings used by remote PowerShell sessions on the local computer and display the properties available.
Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Remove-PSSession cmdlet.
What can I do with it?
Close a remote PowerShell session which is open in the current session.
Examples:
Establish a persistent remote PowerShell connection to Test01 using New-PSSession , return the results for which services begin with T, then remove that session. Finally confirm the session has been removed by running Get-PSSession and seeing no results.
Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the New-PSSessionOption cmdlet.
What can I do with it?
Create a new object with advanced session settings to be used when opening PowerShell remote sessions.
Examples:
Show the possible options which can be set with New-PSSessionOption
New-PSSessionOption
Set some advanced session options via the $sessionoptions variable and use them to make a remote PowerShell connection.
Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Get-PSSession cmdlet.
What can I do with it?
Retrieve remote PowerShell sessions created in the current session.
Examples:
Get all current sessions
Get-PSSession
Get session 3.
Get-PSSession -Id 3
Get all sessions open with Test01. (Not well illustrated in this screenshot since there is only one server with sessions open, but you get the idea)
Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the New-PSSession cmdlet.
What can I do with it?
Establish a persistent connection to a computer that has been enabled for PowerShell remoting.
Examples:
Establish a persistent remote PowerShell connection to Test01 and store it in the variable $session. Then use the Enter-PSSession cmdlet with the Session parameter to use that session.
$session = New-PSSession -ComputerName Test01 Enter-PSSession -Session $session
Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Invoke-Command cmdlet.
What can I do with it?
Run commands on local or remote computers and return the results.
Examples:
Establish a persistent remote PowerShell connection to Test01 using New-PSSession and store it in the variable $session. Then return the results for which services begin with T.
$session = New-PSSession -ComputerName Test01 Invoke-Command -Session $session -ScriptBlock {Get-Service | Where-Object {$_.
Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Enter-PSSession cmdlet.
What can I do with it?
Open an interactive PowerShell session with a computer which has been enabled for PowerShell remoting.
Example:
Open a session with the server Test01 and see which services begin with the letter T.
Enter-PSSession -ComputerName Test01 Get-Service | Where-Object {$_.name -like ‘T*’}
You will notice that the prompt has changed to
Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Exit-PSSession cmdlet.
What can I do with it?
Exit an interactive PowerShell session that has been opened on a computer which has been enabled for PowerShell remoting.
Example:
Leave an interactive PowerShell session with a computer which has been enabled for PowerShell remoting.
Exit-PSSession
You will notice that the prompt has changed back from
Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Enable-PSRemoting cmdlet.
What can I do with it?
Configure a computer to be enabled for PowerShell remoting. Tip: Make sure you run this cmdlet from an elevated process.
Example:
Configure the computer Test01 to be enabled for PowerShell remoting.
Enable-PSRemoting
This will produce output similar to the below; note the command was run on a Windows Server 2008 64bit system
Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Import-Counter cmdlet.
What can I do with it?
Create objects by importing performance data in BLG, CSV or TSV files.
Example:
Import as objects data in a BLG file previously exported from Export-Counter or the Performance Monitor GUI.
$performancedata = Import-Counter -Path Memory.blg
How could I have done this in PowerShell 1.0?
To manage performance data contained in a BLG file you could have used the Performance Monitor GUI to import it and view the contents.