简体   繁体   中英

Check IIS logFile.period on remote server with Powershell

I need to check the IIS log settings of about 100 servers. I'm running PS 5, and I've figured out that this gives me the settings for the local server:

Import-Module WebAdministration

Get-ChildItem IIS:\Sites

Get-ItemProperty 'IIS:\Sites\Default Web Site' -Name logFile.period

What do I need to do in order to run the same thing on remote servers?

PSRemoting is what you are asking about.

This is a well-documented (using a GUI and PowerShell) thing and articles and sample code are all over the web.

'use remoting to get IIS logs'

Invoke-Command Runs commands on local and remote computers.

invoke-command -ComputerName 'IIS' -ScriptBlock {
    Import-Module WebAdministration
    Get-ChildItem IIS:\Sites
    Get-ItemProperty 'IIS:\Sites\Default Web Site' -Name logFile.period
}

How to retrieve IIS HTTP logs remotely

Using IIS Manager for Remote Administration

Use PowerShell to Collect, Store, and Parse IIS Log Data

Get IIS log location via powershell? Get IIS log location via powershell?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM