Iis 在所有站点上禁用时返回已启用的日志记录

Iis 在所有站点上禁用时返回已启用的日志记录,iis,powershell,logging,Iis,Powershell,Logging,使用此代码进行远程处理: $pssessIIS = New-PSSession -ComputerName <servername> Invoke-Command -session $pssessIIS -ScriptBlock { if ([System.Version] (Get-ItemProperty -path \"HKLM:\\Software\\Microsoft\\Windows NT\\CurrentVersion\").CurrentVersion -ge

使用此代码进行远程处理:

$pssessIIS = New-PSSession -ComputerName <servername>
Invoke-Command -session $pssessIIS -ScriptBlock {
if ([System.Version] (Get-ItemProperty -path \"HKLM:\\Software\\Microsoft\\Windows     NT\\CurrentVersion\").CurrentVersion -ge [System.Version] \"6.1\") { 
Import-Module WebAdministration 
} else { Add-PSSnapin WebAdministration }
Invoke-Command -scriptblock { 
IIS:
Get-ItemProperty IIS:\\Sites\\'Default Web Site' -Name LogFile | select-object enabled }
}
Remove-PSSession -Session $pssessIIS
exit
它返回已启用的远程&t'ing到服务器和在本地运行ps命令,但是,从IIS mmc中,所有网站都禁用了日志记录,并且当前没有任何网站被写入


所以问题是,为什么在禁用所有日志记录的情况下,我要从powershell IIS中启用?它只是报告它找到了一个日志文件吗?

您是否得到了正确的值

(Get-WebConfiguration -Filter system.webServer/httpLogging -PSPath 'IIS:\sites\Default Web Site').dontLog

谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢。