How to Check and Change SQL Server Server-level Settings in Powershell?

# Step 1 - Check the server settings. Be aware of the location
PS SQLSERVER:\sql\xu-acer-pc> $a=dir
PS SQLSERVER:\sql\xu-acer-pc> $a.edition
# Enterprise Evaluation Edition (64-bit)
# Developer Edition (64-bit)

#Step 2 - for the next level of settings
PS SQLSERVER:\sql\xu-acer-pc> $a.settings
<#
AuditLevel            : Failure
BackupDirectory       : C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Backup
DefaultFile           : C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\
DefaultLog            : C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\
LoginMode             : Integrated
MailProfile           :
NumberOfLogFiles      : -1
PerfMonMode           : None
TapeLoadWaitTime      : -1
Parent                : [XU-ACER-PC]
OleDbProviderSettings : {ADsDSOObject, Microsoft.ACE.OLEDB.12.0, Microsoft.ACE.OLEDB.15.0, MSDAOSP...}
Urn                   : Server[@Name='XU-ACER-PC']/Setting
Properties            : {Name=AuditLevel/Type=Microsoft.SqlServer.Management.Smo.AuditLevel/Writable=True/Value=Failure,
                        Name=BackupDirectory/Type=System.String/Writable=True/Value=C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Backup,
                        Name=DefaultFile/Type=System.String/Writable=True/Value=C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\,
                        Name=DefaultLog/Type=System.String/Writable=True/Value=C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\...}
UserData              :
State                 : Existing

AuditLevel            : Success
BackupDirectory       : C:\Program Files\Microsoft SQL Server\MSSQL12.I2\MSSQL\Backup
DefaultFile           : C:\Program Files\Microsoft SQL Server\MSSQL12.I2\MSSQL\DATA\
DefaultLog            : C:\Program Files\Microsoft SQL Server\MSSQL12.I2\MSSQL\DATA\
LoginMode             : Integrated
MailProfile           :
NumberOfLogFiles      : -1
PerfMonMode           : None
TapeLoadWaitTime      : -1
Parent                : [XU-ACER-PC\I2]
OleDbProviderSettings : {ADsDSOObject, Microsoft.ACE.OLEDB.12.0, Microsoft.ACE.OLEDB.15.0, MSDAOSP...}
Urn                   : Server[@Name='XU-ACER-PC\I2']/Setting
Properties            : {Name=AuditLevel/Type=Microsoft.SqlServer.Management.Smo.AuditLevel/Writable=True/Value=Success,
                        Name=BackupDirectory/Type=System.String/Writable=True/Value=C:\Program Files\Microsoft SQL Server\MSSQL12.I2\MSSQL\Backup,
                        Name=DefaultFile/Type=System.String/Writable=True/Value=C:\Program Files\Microsoft SQL Server\MSSQL12.I2\MSSQL\DATA\,
                        Name=DefaultLog/Type=System.String/Writable=True/Value=C:\Program Files\Microsoft SQL Server\MSSQL12.I2\MSSQL\DATA\...}
UserData              :
State                 : Existing
#>

#Step 3 - I want to change the AuditLevel for Instance I2 back to Failure
PS SQLSERVER:\sql\xu-acer-pc> $a=dir |? {$_.Instancename-eq "I2"} # select the insance, you cannot set setting property for multiple instances at one time
PS SQLSERVER:\sql\xu-acer-pc> $a.settings.AuditLevel="Failure" # set it to a new value

PS SQLSERVER:\sql\xu-acer-pc> $a.settings # make sure it has been changed