Get-Service 2. 获取名为“Network”的服务信息:Get-Service-Name Network 3. 获取显示名称为“网络连接”的服务信息:Get-Service-DisplayName "网络连接"4. 获取远程计算机上的服务信息(假设你知道远程计算机的名称或IP地址):Get-Service-ComputerName "RemoteComputer"在使用这些示例时,请确保你正在查询的服务...
Get Service Status From Remote Computer Using PowerShell There are many ways to connect to a remote computer and access its services. Windows PowerShell facilitates this by theGet-WmiObjectcmdlet. It can be used to manage resources on a remote computer easily. You can run theGet-WmiObjectcommand...
Invoke-Command-ComputerName"RemoteComputerName"-ScriptBlock{Get-EventLog-LogNameSystem-Newest50} 这个命令可以在远程计算机上获取最新的系统事件日志。 远程配置防火墙规则: powershellCopy Code Invoke-Command -ComputerName"RemoteComputerName"-ScriptBlock{ New-NetFirewallRule -DisplayName"AllowPing"-DirectionInbo...
Get-CimInstance-ClassNameWin32_Service|Select-Object-PropertyStatus,Name,DisplayName 输出 Status Name DisplayName --- --- --- OK AJRouter AllJoyn Router Service OK ALG Application Layer Gateway Service OK AppIDSvc Application Identity OK Appinfo Application Information OK AppMgmt Application Management ...
Invoke-Command-ComputerNameServer02-ScriptBlock{Get-Service} 还可使用其他*-Servicecmdlet 管理服务。 有关 PowerShell 远程处理的详细信息,请参阅about_Remote。 获取必需和从属服务 Get-Service cmdlet 具有两个在服务管理中非常有用的参数。 DependentServices 参数获取依赖于该服务的服务。
管線上一個命令,以顯示Get-Member結果確實已還原串行化物件。 PowerShell Invoke-Command-ComputerNamedc01, sql02, web01 {Get-Service-NameW32time}-Credential$Cred|Get-Member Output TypeName: Deserialized.System.ServiceProcess.ServiceController Name MemberType Definition --- --- --- GetType Method type Ge...
-ComputerName:指定要在远程计算机上执行操作。默认情况下,该命令在本地计算机上执行。 -Credential:指定用于连接到远程计算机的凭据。可以使用 Get-Credential 命令来获取凭据对象。 -Verbose:显示详细的操作信息。 -IncludeAllSubFeature:包括所有子功能。默认情况下,该命令只返回顶级功能。
Get-Service Set-Service Get-WinEvent Get-WmiObject 通过以上的命令我们可以去操作主机的服务及进程等,例如可以去开启“WinRM”服务 例子1:远程重启计算机 使用“Restart-Computer”命令重启计算机,如果有用户登录的情况下,无法执行,可以加上“-Force”参数强制执行。
Get-Service: Advanced Usage Examples Check Services on a Remote Computer with PowerShell Syntax and Basic Usage of the Get-Service Cmdlet The basic syntax and available parameters of the Get-Service cmdlet are as follows: Get-Service [[-Name] <string[]>] [-ComputerName <string[]>] [-Depen...
Invoke-Command -ComputerName "RemoteComputerName" -ScriptBlock { Start-Service -Name "ServiceName" } 透過Invoke-Command 可以在遠端計算機上啟動特定的服務。 遠端關閉計算機: powershellCopy Code Invoke-Command -ComputerName "RemoteComputerName" -ScriptBlock { Stop-Computer -Force } ...