We must follow these steps to change the IIS log location using PowerShell. Bobcares, as a part of our Server Management Service offers solutions to every query that comes our way.
How to Change IIS Log Location with Powershell?
On the Windows, the IIS log location will be in C:\inetpub\logs\LogFiles
. However, the actual location varies depending on the server config or any custom settings applied by the admin. PowerShell makes changing the IIS log location simple and easy. We may easily change it by using cmdlets. It define the new location, we can redirect log files seamlessly to the new folder. This lets us automate admin tasks with little effort and ensures that the IIS server runs well.
Using PowerShell to modify the log location needs adjusting the IIS server’s setup parameters. Here is a simple guide on how to do it:
1. Initially, right-click on PowerShell, choose “Run as admin” to get the necessary rights.
2. Then, we use the Import-Module WebAdministration to enable managing IIS.
3. Also, use Get-WebConfigurationProperty to see where logs are stored.
4. Now, change the log location with Set-WebConfigurationProperty, specifying the new path in quotes.
5. Next, confirm the new log directory with Get-WebConfigurationProperty.
6. We can use the Restart-Service W3SVC to apply changes.
7. Lastly, make sure new logs are appearing in the location by using the sites hosted on IIS.
[Searching solution for a different question? We’re happy to help.]
Conclusion
The article explains the steps from our Tech team to easily adjust the IIS log location using the Powershell.
var google_conversion_label = "owonCMyG5nEQ0aD71QM";
0 Comments