I am looking for a powershell script to enable the field in one of the logging definitions in IIS advanced logging.
See screenshot as below.
I tried the following command.
Set-WebConfigurationProperty -Filter "system.webServer/advancedLogging/Server/logDefinitions/[@baseFileName='%COMPUTERNAME%-Server']/selectedFields" -PSPath machine/webroot/apphost -Name VIP_Name -value "True"
I get the following error
Set-WebConfigurationProperty : Unexpected token Input: get-config("MACHINE/WEBROOT/APPHOST")/system.webServer/advancedLogging/Server/log Definitions/[@baseFileName='%COMPUTERNAME%-Server']/Fields Position: 93 Length: 1 Fragment: [ At D:\AdvanceLogging.ps1:10 char:1 + Set-WebConfigurationProperty -Filter "system.webServer/advancedLoggin ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Set-WebConfigurationProperty], Argumen tException + FullyQualifiedErrorId : System.ArgumentException,Microsoft.IIs.PowerShell.Provide
r.SetConfigurationPropertyCommand
I dont know if the above command is the right one, can someone please help ?
If you wanna add that filter in server node Please try this.
If you want to set filter in site level, Please use this command.