Test-SbecConfig

Validates a configuration.

Syntax

Test-SbecConfig
    [-Content] <String[]>
    [-Continue]
    [[-ComputerName] <String[]>]
    [[-CimSession] <CimSession[]>]
    [<CommonParameters>]

Description

The Test-SbecConfig cmdlet validates a configuration for the Setup and Boot Event Collector.

This cmdlet checks a configuration for validity without applying it. This is similar to running the command bevtcol.exe -checkOnly, except that Test-SbecConfig uses the running service to perform the validation.

The values that Test-SbecConfig returns are a subset of those returned by Set-SbecActiveConfig, because Test-SbecConfig does not apply the configuration.

You must have the Builtin Administrator privilege to run this command.

This cmdlet is also available using the alias Validate-SbecConfig.

Examples

Example 1: Validate a configuration

PS C:\> $res = Test-SbecConfig -Content $NewConfig -Continue

This command validates the configuration in $NewConfig, and then stores the results in the $res variable. Because the Continue parameter is specified, the command does not throw an error if any errors occur.

Example 2: Validate a configuration using the pipeline

PS C:\> Get-Content MyConfig.xml | Test-SbecConfig -Continue | Format-List

This command validates the configuration from a file. Format-List prints all the returned information without reducing it.

Example 3: Validate a configuration and throw on error

PS C:\> $res = Test-SbecConfig -Content (Get-Content MyConfig.xml)

Validate the configuration from a file and throw on error.

Parameters

-CimSession

Runs the cmdlet on the remote computers through a remote session. Enter a session object, such as the output of a New-CimSession or Get-CimSession cmdlet or an array of these objects. The default is to run the cmdlet on the local computer. For more information, see About_CimSession.

Type:CimSession[]
Position:2
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ComputerName

Specifies the names of the computers on which you want to perform the operation. You can specify a fully qualified domain name (FQDN), a NetBIOS name, or an IP address for each computer. For more information see Invoke-CimMethod on MSDN.

Type:String[]
Position:1
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Content

Specifies the configuration to validate. The acceptable values for this parameter are:

  • A multiline string. Use \n to indicate line breaks.
  • An array of one-line strings. This cmdlet merges the array.
  • A mix of multiline strings and string arrays.
Type:String[]
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Continue

Indicates that this operation will not throw an exception if a failure occurs. Instead the caller should examine the output of the cmdlet for the error information.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

string[]

The text of the configuration, same as in the Content parameter.

Outputs

hash table

The hash table includes the following elements:

  • <Success>
  • <ErrorType>
  • <ErrorString>
  • <WarningString>
  • <InfoString>

The <ErrorType> element contains 0 on success. If a failure occurs, <ErrorType> has a code that describes the error:

  • 1 (bad argument format)
  • 2 (bad argument value)

The <Success> element is $True on success, $False otherwise.

<ErrorString>, <WarningString>, and <InfoString> contain detailed error messages. <ErrorString> contains information only if an error occurs.