New-SPLogFile PowerShell - create new SharePoint log file


Analyzing SharePoint logs has never been an easy task. Though there are tools available for better reading of logs, huge log files can always give you some pain and extra efforts.

What to do when the log file is very huge in size. Is there a way to create a new fresh logfile whenever required? The answer is Yes!

New-SPLogFile PowerShell cmdlet

Whenever you feel the current log file is getting large (even a few MBs), use the New-SPLogFile command to generate a new log file quickly.

Just open SharePoint Management Shell as administrator (right-click - run as administrator) and type below command

Syntax |CBS||New-SPLogFile [-AssignmentCollection <SPAssignmentCollection>]

where AssignmentCollection is an optional parameter which manages objects for the purpose of proper disposal.

Example: New-SPLogFile

So simple, yet very handy command.



















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap