- AWS Tools for PowerShell 6
- Ramesh Waghmare
- 298字
- 2021-07-15 17:09:14
Running PowerShell remotely
One of the advantages of PowerShell is accessing the remote servers. Running commands on remote servers is called PowerShell remoting, and this is not something new. Many IT admins run PowerShell on their client-side desktops and access servers located in different data centers to ease the administrative effort. In the cmdlets, there is a ComputerName parameter that you can use to run the command on the remote server. You just need to ensure that the ComputerName parameter specified is seen on the network and has a remoting option enabled. Let's say you want to run the Get-Service cmdlet on the server called apps1, then you can run this:
PS C:\>Get-Service -ComputerName apps1
So, all the cmdlets that you run locally can be run on the remote server just by specifying the ComputerName parameter with it.
PowerShell is locked down by default. In order to enable remoting, you have to run the Enable-PsRemoting cmdlet:
PS C:\> Enable-PsRemoting -Force
This command starts the Windows Remote Management (WinRM) service, sets it to start automatically with your system, and creates a firewall rule that allows incoming connections. The Force part of the command tells PowerShell to perform these actions without prompting you for each step. You should restart the WinRM service so that new settings can take effect:
PS C:\Restart-Service WinRM
For testing the connection, you can use this:
PS C:\Test-WsMan <RemoteComputer>
PS C:\Enter-PsSession -ComputerName <RemoteComputer>
Or you can run any other cmdlet with ComputerName parameter.
- ExtGWT Rich Internet Application Cookbook
- 零基礎(chǔ)PHP學(xué)習(xí)筆記
- INSTANT FreeMarker Starter
- Mastering QGIS
- 深入淺出Spring Boot 2.x
- Unity 5 for Android Essentials
- PHP從入門到精通(第4版)(軟件開發(fā)視頻大講堂)
- Web前端應(yīng)用開發(fā)技術(shù)
- JBoss:Developer's Guide
- C語言程序設(shè)計(jì)與應(yīng)用(第2版)
- Scala編程實(shí)戰(zhàn)
- C++ System Programming Cookbook
- Python Programming for Arduino
- Python網(wǎng)絡(luò)爬蟲實(shí)例教程(視頻講解版)
- Android 游戲開發(fā)大全(第二版)