Add-SPDiagnosticsPerformanceCounter
新增效能計數器的執行個體至 Web 前端電腦或資料庫伺服器。
Syntax
Add-SPDiagnosticsPerformanceCounter
[-Category] <String>
-Counter <String>
[-AllInstances]
[-AssignmentCollection <SPAssignmentCollection>]
[-Confirm]
[-DatabaseServer]
[-WebFrontEnd]
[-WhatIf]
[<CommonParameters>]
Add-SPDiagnosticsPerformanceCounter
[-Category] <String>
[-Counter <String>]
-Instance <String>
[-AllInstances]
[-AssignmentCollection <SPAssignmentCollection>]
[-Confirm]
[-DatabaseServer]
[-WebFrontEnd]
[-WhatIf]
[<CommonParameters>]
Add-SPDiagnosticsPerformanceCounter
[-Category] <String>
[-Instance <String>]
[-AllInstances]
[-AssignmentCollection <SPAssignmentCollection>]
[-Confirm]
[-DatabaseServer]
[-WebFrontEnd]
[-WhatIf]
-CounterList <String[]>
[<CommonParameters>]
Description
此 Cmdlet 包含一個以上的參數集。 您可能只使用一個參數集中的參數,但不可以結合不同參數集的參數。 如需如何使用參數集的詳細資訊,請參閱 Cmdlet 參數集。
Add-SPDiagnosticsPerformanceCounter Cmdlet 會將效能計數器新增至前端 Web 服務器或資料庫伺服器。 效能計數器會讀取並記錄在使用量資料庫中。 根據預設,新的效能計數器會新增至伺服器陣列中的資料庫伺服器。
範例
------------------範例 1------------------
C:\PS>Add-SPDiagnosticsPerformanceCounter -category ASP.NET -Counter "Requests Queued"
此範例會在前端網頁電腦上新增名為 ASP.NET\Requests Queued 的計數器。
------------------範例 2------------------
C:\PS>Add-SPDiagnosticsPerformanceCounter -category PhysicalDisk -counter "Avg. Disk Queue Length" -allinstances
此範例會在前端網頁電腦上的 Avg. Disk Queue Length 類別中新增 PhysicalDisk 計數器的所有執行個體。
------------------範例 3------------------
C:\PS>Add-SPDiagnosticsPerformanceCounter -category Processor -counter "% Processor Time" -instance "_Total" -databaseserver
此範例會在資料庫伺服器上的 Processor 類別中新增 % Processor Time 計數器的 _Total 執行個體。
參數
-AllInstances
收集目標 Web 前端電腦或資料庫伺服器上計數器類別與類型的所有執行個體。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-AssignmentCollection
管理物件以適當處置它們。 使用 SPWeb 或 SPSite 等物件可能會耗用大量的記憶體,因此在 Windows PowerShell 指令碼中使用這些物件時,必須適當地管理記憶體。 您可以使用 SPAssignment 物件將物件指派給變數,並在不需要時處置這些物件,以釋放記憶體。 使用 SPWeb、SPSite 或 SPSiteAdministration 物件時,若未使用指派集合或 Global 參數,將會自動處置這些物件。
使用 Global 參數時,所有物件會包含在全域儲存區內。 若未立即使用物件,或未使用 Stop-SPAssignment 命令處置物件,將會發生記憶體不足的狀況。
Type: | SPAssignmentCollection |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Category
指定效能計數器的類別以新增至目標 Web 前端電腦或資料庫伺服器。
此類型必須是效能計數器類別的有效名稱,例如 ASP.NET、PhysicalDisk 或 Processor。
Type: | String |
Position: | 2 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Confirm
在執行命令之前,提示您確認操作。
如需詳細資訊,請輸入下列命令:get-help about_commonparameters
。
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Counter
指定計數器的類型以新增至目標 Web 前端電腦或資料庫伺服器。
此類型必須是計數器類型的有效名稱,例如 Requests Queued、Avg. Disk Queue Length 及 % Processor Time。
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-CounterList
{{填寫 CounterList 描述}}
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2016, SharePoint Server 2019 |
-DatabaseServer
新增指定的效能計數器至伺服器陣列中的所有資料庫伺服器。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-Instance
指定新效能計數器的顯示名稱。
此類型必須是效能計數器執行個體的有效名稱,例如 Total_PerfCounter。
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-WebFrontEnd
新增指定的效能計數器至伺服器陣列中的所有 Web 前端電腦。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
-WhatIf
顯示訊息會描述命令的功效而不執行命令。
如需詳細資訊,請輸入下列命令:get-help about_commonparameters
。
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |