Stop-SqlInstance
停止指定的 SQL Server 執行個體。
語法
Stop-SqlInstance
[-Path <String[]>]
[-Credential] <PSCredential>
[-AutomaticallyAcceptUntrustedCertificates]
[-ManagementPublicPort <Int32>]
[-RetryTimeout <Int32>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Stop-SqlInstance
-InputObject <Server[]>
[-Credential] <PSCredential>
[-AutomaticallyAcceptUntrustedCertificates]
[-ManagementPublicPort <Int32>]
[-RetryTimeout <Int32>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Stop-SqlInstance
-ServerInstance <String[]>
[-Credential] <PSCredential>
[-AutomaticallyAcceptUntrustedCertificates]
[-ManagementPublicPort <Int32>]
[-RetryTimeout <Int32>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Stop-SqlInstance Cmdlet 會停止指定的 SQL Server 實例。
SQL Server 雲端配接器必須在主控 SQL Server 執行個體的電腦上執行及存取。
這個 Cmdlet 支援下列作業模式:
- 指定實例Windows PowerShell路徑。
- 指定伺服器物件。
- 指定目標實例SQL Server的 ServerInstance 物件。
Note: This cmdlet ceased to work a long time ago. It's been removed in version 22 of the module.
範例
範例 1:停止實例SQL Server
PS C:\> CD SQLSERVER:\SQL\Computer\Instance
PS SQLSERVER:\SQL\Computer\Instance> Stop-SqlInstance -Credential $Credential -AcceptSelfSignedCertificate
第一個命令會將工作目錄變更為 SQLSERVER:\SQL\Computer\Instance
。
範例 2:停止指定電腦上的所有SQL Server實例
PS C:\> Get-SqlInstance -Credential $Credential -MachineName "Computer006" | Stop-SqlInstance -Credential $Credential -AcceptSelfSignedCertificate
此命令會在名為 Computer006
的電腦上擷取所有SQL Server實例,並停止所有實例。
系統會自動接受目的電腦的自我簽署憑證,而不提示使用者。
參數
-AutomaticallyAcceptUntrustedCertificates
表示此 Cmdlet 會自動接受不受信任的憑證。
類型: | SwitchParameter |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Confirm
在執行 Cmdlet 前提示您確認。
類型: | SwitchParameter |
別名: | cf |
Position: | Named |
預設值: | False |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Credential
指定目的電腦上具有 Windows 系統管理員認證的使用者帳戶。
類型: | PSCredential |
Position: | 0 |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-InputObject
指定目標實例的伺服器物件陣列。
類型: | Server[] |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-ManagementPublicPort
指定目的電腦上的公用管理埠。 當目的電腦的埠無法直接存取,但會透過端點公開時,就會使用此參數。 這表示此 Cmdlet 必須連線到不同的埠。
SQL Server 雲端配接器必須以此連接埠存取。
類型: | Int32 |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Path
指定SQL Server實例的路徑做為字串陣列,此 Cmdlet 會在其中執行作業。 如果您未指定此參數的值,Cmdlet 會使用目前的工作位置。
類型: | String[] |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-RetryTimeout
指定要在目標伺服器上重試命令的時間週期。 超過逾時設定之後,就不會再嘗試重試。
類型: | Int32 |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-ServerInstance
指定SQL Server實例的名稱做為字串陣列,成為作業的目標。
類型: | String[] |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-WhatIf
顯示執行 Cmdlet 後會發生的情況。 Cmdlet 並不會執行。
類型: | SwitchParameter |
別名: | wi |
Position: | Named |
預設值: | False |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
輸入
Microsoft.SqlServer.Management.Smo.Server[]
System.String[]