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.




Recent Posts:




Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.