Get-SbecActiveConfig

Get-SbecActiveConfig is accessible with the help of BootEventCollector module. To configure BootEventCollector, go through this link.

Synopsis

Gets the current active configuration from the running Setup and Boot Event Collector.

Description

The Get-SbecActiveConfig cmdlet returns a hash table with two elements, <Content> and <Timestamp>. The <Content> element contains the text of the active configuration as a single string. The <Timestamp> element contains the timestamp when that configuration was set, as a FILETIME 64-bit value.

You can use the timestamp to verify that the configuration didn’t change since the last reading. You can also use it to get the configuration, modify it locally, and set it back, and ensuring that nobody has modified it during that time.

You can modify the text of the configuration from the exact text that was last set. You can normalize it by removing all the carriage return (\r) characters and by removing any empty lines at the end of configuration.

This command throws an error on failures.

This command is available only to the users having the Builtin Administrator (BA) privilege.

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:1
Default value:None
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 TechNet.

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

Syntax

Get-SbecActiveConfig [[-ComputerName] <String[]>] [[-CimSession] <CimSession[]>] [<CommonParameters>]

—————–Example 1—————–
Get the active configuration
PS C:\> $res = Get-SbecActiveConfig
PS C:\> $time = [DateTime]::FromFileTimeUtc($res.Timestamp)
PS C:\> $text = $res.Content
First command gets the active configuration, and then stores it in the $res variable.
Second command converts the returned timestamp to the PowerShell format, and then stores it in the $res variable.
Third command extracts the returned text of the configuration as a single string, and then stores it in the $text variable.

—————–Example 2—————–
Print the complete returned information
PS C:\> Get-SbecActiveConfig | Format-List
This command gets the active configuration and pipes it to Format-List, which formats the results.

You can check the Version, CommandType and Source of this cmdlet by giving below command.

Get-Command Get-SbecActiveConfig

Get-Command Get-SbecActiveConfig powershell script command cmdlet

You can also read about

  • Set-SbecActiveConfig
  • Test-SbecActiveConfig
  • Test-SbecConfig

To know more PowerShell cmdlets(Commands) on BootEventCollector click here

Click on this Link for an Single place where you get all the PowerShell cmdlet sorted based on the modules.

You can also refer other blogs on PowerShell at link

You can also refer other blogs on Microsoft at link

And also if you required any technology you want to learn, let us know below we will publish them in our site http://tossolution.com/

Like our page in Facebook and follow us for New technical information.

References are taken from Microsoft

Leave a Reply

Your email address will not be published. Required fields are marked *