2016-01-04 64 views
1

我試圖從applicationHost配置文件刪除centralBinaryLogFile元素:在ApplicationHost配置文件中刪除元素

我使用下面的刪除此:

Remove-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' -Filter 'system.applicationHost/log' -Name 'centralBinaryLogFile' 

但是,只要它每一次抱怨我試着用下面的刪除:

**WARNING: Property centralBinaryLogFile is not found on /system.applicationHost/log.** 

我知道,如果我跑下面我得到的元素回去細存在:

Get-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' -Filter 'system.applicationHost/log' -Name 'centralBinaryLogFile' 


enabled   : True 
directory   : %SystemDrive%\inetpub\logs\LogFiles 
period   : Daily 
truncateSize  : 20971520 
localTimeRollover : False 
ItemXPath   : /system.applicationHost/log 
Attributes  : {enabled, directory, period, truncateSize...} 
ChildElements  : {} 
ElementTagName : centralBinaryLogFile 
Methods   : 
Schema   : Microsoft.IIs.PowerShell.Framework.ConfigurationElementSchema 

我還試圖用下面的思考哈希表可能做的伎倆 - 但隨後抱怨說,名稱不是一個集合

Remove-WebconfigurationProperty -Filter "system.applicationHost/log" "Machine/WebRoot/AppHost" -Name centralBinaryLogFile -AtElement @{ElementTagName="centralBinaryLogFile"} 

任何想法我怎麼刪除此嗎?

+0

你忽略了的代碼示例如何試圖將其刪除。 – dugas

+0

是的 - 對不起,現在添加它。我也在問題的底部嘗試了另一條線 - 既不是我目前不幸的那樣做。 – lara400

回答

1

我嘗試了同樣的事情,並得到相同的行爲。我知道這不是消除它,但會失效嗎?

Set-WebConfiguration -PSPath 'MACHINE/WEBROOT/APPHOST' -Filter 'system.applicationHost/log/centralBinaryLogFile' -value @{enabled=$false} 
+0

是的 - 那會做現在感謝。 – lara400

+0

我在最後找到了答案......它不是REMOVE-WEBCONFIGURATION ....但是CLEAR-WEBCONFIGURATION ...清除-WebConfiguration -PSPath'MACHINE/WEBROOT/APPHOST'-Filter'system.applicationHost/log/centralBinaryLogFile 「 – lara400

2

萬一別人卡住和頭在旋轉......不使用刪除,webconfigurationproperty但CLEAR-WebConfiguration:

Clear-WebConfiguration -PSPath 'MACHINE/WEBROOT/APPHOST' -Filter 'system.applicationHost/log/centralBinaryLogFile'