iis - 当在所有站点上禁用日志记录时返回启用日志记录

标签 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 [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

它返回“已启用”远程和 TS'ing 到服务器并在本地运行 ps 命令,但是,从 IIS mmc,所有网站都已禁用日志记录,并且当前没有写入任何内容。

所以问题是,当所有日志记录都被禁用时,为什么我会从 powershell IIS“启用”?它只是报告它找到了一个日志文件吗?

最佳答案

你能得到正确的值吗?

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

关于iis - 当在所有站点上禁用日志记录时返回启用日志记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10219357/

相关文章:

PHP Manager IIS 无法安装 Windows 10

c# - 找不到 Microsoft.AspNetCore.Antiforgery

powershell - 方法调用失败,因为 [System.Management.Automation.PSObject] 不包含名为 'op_Addition' 的方法

php - Laravel 5.6 升级导致日志记录中断

java - 如何在静态上下文中获取类的记录器?

ssl - 如何在IIS中发送 "Certificate Request"

powershell - Azure DevOps-在PowerShell脚本中设置和使用变量

powershell - Azure AD - 以应用程序管理员身份启用服务主体

javascript - JS : write a join function using reduce method . .. 函数的控制台日志返回不正确的输出

powershell - 如何在 Windows 2016 上使用 Powershell IISAdministration 模块为 IIS 网站设置需要 SSL