PowerShell Logo Small

Test-PSSessionConfigurationFile



This is the built-in help made by Microsoft for the command 'Test-PSSessionConfigurationFile', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Verifies the keys and values in a session configuration file.

SYNTAX


Test-PSSessionConfigurationFile [-Path] <String> [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Test-PSSessionConfigurationFile cmdlet verifies that a session configuration file contains valid keys and the values are of the correct type. For enumerated values, the
cmdlet verifies that the specified values are valid.


By default, Test-PSSessionConfigurationFile returns "True" ($true) if the file passes all tests and "False" ($false) if it does not. To find any errors, use the Verbose
common parameter.


Test-PSSessionConfigurationFile verifies the session configuration files, such as those created by the New-PSSessionConfigurationFile cmdlet. For information about session
configurations, see about_Session_Configurations (http://go.microsoft.com/fwlink/?LinkID=145152). For information about session configuration files, see
about_Session_Configuration_Files (http://go.microsoft.com/fwlink/?LinkID=236023).


This cmdlet is introduced in Windows PowerShell 3.0.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=289619
Disable-PSSessionConfiguration
Enable-PSSessionConfiguration
Get-PSSessionConfiguration
New-PSSessionConfigurationFile
Register-PSSessionConfiguration
Set-PSSessionConfiguration
Test-PSSessionConfigurationFile
Unregister-PSSessionConfiguration
WSMan Provider
about_Session_Configurations
about_Session_Configuration_Files

REMARKS

<

Examples


Example 1: Test a session configuration file

PS C:\>Test-PSSessionConfigurationFile -Path FullLanguage.pssc
True



This command uses the Test-PSSessionConfigurationFile cmdlet to test a new session configuration file before using it in a session configuration.






Example 2: Test the session configuration file of a session configuration

PS C:\>Test-PSSessionConfigurationFile -Path (Get-PSSessionConfiguration -Name Restricted).ConfigFilePath



This command uses the Test-PSSessionConfigurationFile cmdlet to test the session configuration file that is being used to in the Restricted session configuration. The value
of the Path parameter is a Get-PSSessionConfiguration command that gets the Restricted session configuration. The path to the session configuration file is stored in the
value of the ConfigFilePath property of the session configuration.






Example 3: Test all session configuration files

PS C:\>
function Test-AllConfigFiles
{
Get-PSSessionConfiguration | ForEach-Object { if ($_.ConfigFilePath)
{$_.ConfigFilePath; Test-PSSessionConfigurationFile -Verbose `
-Path $_.ConfigFilePath }}
}


C:\WINDOWS\System32\WindowsPowerShell\v1.0\SessionConfig\Empty_6fd77bf6-e084-4372-bd8a-af3e207354d3.psscTrueC:\WINDOWS\System32\WindowsPowerShell\v1.0\SessionConfig\Full_1e9c
b265-dae0-4bd3-89a9-8338a47698a1.psscVERBOSE: The member 'AliasDefinitions' must contain the required key 'Description'. Add the require key to the fileC:\WINDOWS\System32\Wi
ndowsPowerShell\v1.0\SessionConfig\Full_1e9cb265-dae0-4bd3-89a9-8338a47698a1.pssc.FalseC:\WINDOWS\System32\WindowsPowerShell\v1.0\SessionConfig\NoLanguage_0c115179-ff2a-4f66-
a5eb-e56e5692ba22.psscTrueC:\WINDOWS\System32\WindowsPowerShell\v1.0\SessionConfig\RestrictedLang_b6bd9474-0a6c-4e06-8722-c2c95bb10d3e.psscTrueC:\WINDOWS\System32\WindowsPowe
rShell\v1.0\SessionConfig\RRS_3fb29420-2c87-46e5-a402-e21436331efc.psscTrue



This function tests all session configuration files that are used in all session configurations on the local computer.

The function uses the Get-PSSessionConfiguration cmdlet to get all session configurations on the local computer. The command pipes the session configuration to the
ForEach-Object cmdlet, which runs a command on each of the session configurations.

The ConfigFilePath property of a session configuration contains the path to the session configuration file that is used in the session configuration, if any.

If the value of the ConfigFilePath property is populated (is true), the command gets (prints) the ConfigFilePath property value. Then it uses the
Test-PSSessionConfigurationFile cmdlet to test the file in the ConfigFilePath value. The Verbose parameter returns the file error when the file fails the test.