Reputation: 949
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?
Upvotes: 0
Views: 755
Reputation: 16076
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?
Upvotes: 1