Millions of businesses utilize SharePoint, Microsoft’s web-based platform for document management and collaboration. All SharePoint operations, including as user access, system faults, and data modifications, must be monitored. Making SharePoint log files is one method for doing this. Script block logging, how to record a PowerShell command, how to print output in PowerShell, and how to clear PowerShell are all topics covered in this article along with how to create SharePoint log files.
Enable Verbose Logging in Step 1
You must first activate verbose logging in order to produce SharePoint log files. All SharePoint operations, including user actions, system events, and data changes, will be recorded as a result. These actions should be followed to enable verbose logging:
Step 1: Go to the Central Administration page for SharePoint. 2. Select Monitoring. 3. Select Configure diagnostic logging from the menu. 4. Under Select a category, choose the category (such as Authentication) for which you want to enable verbose logging. 5. Choose Verbose under Least critical event to report to the event log. 6. Choose Verbose under Least critical event to report to the trace log. 7. Select OK.
Create SharePoint Log Files in Step 2 Verbose logging will begin producing log files as soon as it is enabled in SharePoint. The SharePoint trace logs folder houses these log files. Follow these methods to view these log files:
Step 1: Go to the Central Administration page for SharePoint. 2. Select Monitoring. 3. Select Configure diagnostic logging from the menu. 5. Open the log file directory and look for the SharePoint log files.
4. Under Trace Log, record the path to the log file directory. Making a PowerShell Command Recorder PowerShell is an effective management tool for SharePoint. Use these steps to record a PowerShell command: 2. Type the PowerShell command you want to record after opening PowerShell in step one.
3. Add the next PowerShell command at the end of your command: From Out-File C:-Append PowerShellLog.txt 4. Key in “Enter.” 5. The PowerShellLog.txt file will contain a record of your PowerShell command. Logging for Script Blocks PowerShell has a feature called “script block logging” that keeps track of every command and script that is run. For auditing and troubleshooting purposes, this capability is helpful. Use these procedures to enable script block logging: Open PowerShell, then enter the following commands:
1. Open PowerShell, then enter the following commands:
2. Type Set-ExecutionPolicy RemoteSigned, then press Enter,
4. Type Enable-PSRemoting, then press Enter,
6. Type Set-ItemProperty -Path, then press Enter. HKLM:SoftwareWow6432NodeMicrosoftPowerShell3Press Enter after typing PowerShellEngine -Name ScriptBlockLogging -Value 1
7.
PowerShell Printing Output
Use the Write-Output command in PowerShell to print output. For instance, enter the following command to print “Hello, World!” “Hello, world!” is written out.
PowerShell cleanup
Use the Clear-Host command to clean up PowerShell. For instance, enter the following command to clean out the PowerShell console:
* Clear-Host
Creating SharePoint log files is a crucial step for monitoring SharePoint activities, to sum up. It’s simple to enable verbose logging and examine the SharePoint log files. Other crucial duties for SharePoint administrators include recording a PowerShell command, activating script block logging, publishing output in PowerShell, and clearing PowerShell. To manage SharePoint successfully, adhere to the instructions provided in this article.
Yes, a section on utilizing a PowerShell Do While loop to continuously monitor a SharePoint site and write log files is included in the article “Creating SharePoint Log Files: A Step-by-Step Guide”.