10 PowerShell commands help you manage the remote computer most effectively

Windows PowerShell is a Command executive command system and Script scripting language that you can use to manage your system. In the following article, Network Administrator will show you 10 PowerShell commands to manage your computer remotely effectively.

Windows PowerShell is a "Command executive" command line system and "Script" scripting language that you can use to manage your system. In the following article, Network Administrator will show you 10 PowerShell commands to manage your computer remotely effectively.

10 PowerShell commands help you manage the remote computer most effectively Picture 110 PowerShell commands help you manage the remote computer most effectively Picture 1

Request:

- Your computer is running Windows Vista (or higher).

- Server running on Windows Server 2008 (or higher).

- PowerShell 5.0.

- Access Admin rights.

1. Create a PowerShell session

Order : Enter-PSSession

For example:

Enter-PSSession -ComputerName REMOTE_COMPUTER_NAME -Credential USERNAME

10 PowerShell commands help you manage the remote computer most effectively Picture 210 PowerShell commands help you manage the remote computer most effectively Picture 2

Creating a PSSession allows an Administrator to remotely connect to another computer on the network and run as many PS commands on that computer as well.

During interaction, many commands can be executed remotely, the reason is because the Admin has the same access interface as they are in front of your computer.

10 PowerShell commands help you manage the remote computer most effectively Picture 310 PowerShell commands help you manage the remote computer most effectively Picture 3

10 PowerShell commands help you manage the remote computer most effectively Picture 410 PowerShell commands help you manage the remote computer most effectively Picture 4

2. Execute the commands

Command : Invoke-Command

For example:

Invoke-Command -Computer REMOTE_COMPUTER_NAME -ScriptBlock {PowerShell Command}

10 PowerShell commands help you manage the remote computer most effectively Picture 510 PowerShell commands help you manage the remote computer most effectively Picture 5

Using the Invoke-Command command on PS will produce the same result as executing a session in command 1 above, but when using Invoke to call a remote command, only one command is executed at the same time. that point.

This is to prevent running multiple commands at the same time, unless these commands are saved as a .PS1 file and Script of these commands is called.

3. Restart the computer

Command: Restart-Computer

For example:

Restart-Computer -ComputerName REMOTE_COMPUTER_NAME –Force

10 PowerShell commands help you manage the remote computer most effectively Picture 610 PowerShell commands help you manage the remote computer most effectively Picture 6

Sometimes in some cases when you install or reconfigure the system to work properly, you will then be asked to restart your computer. Or in some other cases, simply restart your computer to apply the changes, refresh the computer. Then you only need to use a single PS command to execute.

4. Ping the computer

Order: Test-Connection

For example:

Test-Connection -ComputerName DESTINATION_COMPUTER_NAME -Source SOURCE_COMPUTER_NAME

10 PowerShell commands help you manage the remote computer most effectively Picture 710 PowerShell commands help you manage the remote computer most effectively Picture 7

PING is one of the most useful commands in the 'arsenal' of Sysadmin (Systems Admin). Simply enter the PING command and the command will check the connection on the current station on your computer and on another remote system.

Test-Connection will 'raise' the PING command to a new level by 'inserting' it into the PS cmdlet.

Suppose in case you need to check the connection information between the server and the remote device. ICMP requests will be sent from the server to the remote device, but the report is sent back to your admin station.

5. View and edit services

Command: Set-Service

For example:

Set-Service -ComputerName REMOTE_COMPUTER_NAME -Name SERVICE_NAME -Status SERVICE_STATUS

10 PowerShell commands help you manage the remote computer most effectively Picture 810 PowerShell commands help you manage the remote computer most effectively Picture 8

Services are sometimes 'difficult'. Depending on what is happening on a specific computer, the service may 'stop' at the worst possible time. Determining running services with the Get-Service cmdlet command helps you capture the status of the current services.

After you have 'fully grasped' available information, you can set the status for the service - either a service that starts with the letter W or you can set up all services at the same time.

10 PowerShell commands help you manage the remote computer most effectively Picture 910 PowerShell commands help you manage the remote computer most effectively Picture 9

6. Run background tasks (side tasks)

Order: Start-Job

For example:

Start-Job -FilePath PATH_TO_SCRIPT.PS1

10 PowerShell commands help you manage the remote computer most effectively Picture 1010 PowerShell commands help you manage the remote computer most effectively Picture 10

Use this command to execute scripts or applications that run in the background without having to log in or perform other tasks. In addition, this command will be executed even if the command fails and does not interrupt the local login of the user on the system.

7. Turn off the computer

Order: Stop-Computer

For example:

Stop-Computer -ComputerName REMOTE_COMPUTER_NAME –Force

10 PowerShell commands help you manage the remote computer most effectively Picture 1110 PowerShell commands help you manage the remote computer most effectively Picture 11

Just like other devices, after using your computer you also need to "rest". When performing the shutdown process, you can use this cmdlet to make sure your computer is "shut down" properly.

8. Join the computer to a domain (domain)

Command: Add-Computer

For example:

Add-Computer -ComputerName COMPUTER_NAMES_TO_BE_JOINED -DomainName DOMAIN.COM -Credential DOMAINUSER -Restart

10 PowerShell commands help you manage the remote computer most effectively Picture 1210 PowerShell commands help you manage the remote computer most effectively Picture 12

The process of joining a computer to a domain is quite simple, you just need to click 3 times, then enter the full Admin information to finish. However, using this traditional way to join hundreds of domains is extremely time consuming.

In this case you can think of a solution that uses PowerShell. The cmdlet command allows joining multiple computers to one domain (domain) at the same time, and only requires entering the Admin information exactly once.

9. Manage applications and services

Command: Import-Module

For example:

Import-Module -Name NAME_OF_POWERSHELL_MODULE

10 PowerShell commands help you manage the remote computer most effectively Picture 1310 PowerShell commands help you manage the remote computer most effectively Picture 13

One of the most outstanding features of PowerShell is managing applications, programs, etc. flexibly, from computer systems to applications like Microsoft Exchange. Some applications and services allow only a certain level of management through a graphical interface. The rest is defaulted to PS management.

This is done through the use of modules that contain the codebase needed to run any PowerShell commands of a particular service or application. Modules are used only when needed, and when they extend PS functionality to a specific service or application. Once completed, you can remove the module completely from the active sessions without having to turn it off.

10. Change the computer name

Order: Rename-Computer

For example:

Rename-Computer -NewName NEW_COMPUTER_NAME -LocalCredential COMPUTERNAMEUSER -Restart

10 PowerShell commands help you manage the remote computer most effectively Picture 1410 PowerShell commands help you manage the remote computer most effectively Picture 14

Depending on many factors, including security, company policies, etc., you can rename the computer or not. Either way, the Rename command is useful in working on one or more systems - groups or on a domain.

The command will rename a device and reboot to apply the changes in effect. For a domain, if the Schema Active Directory supports it, the new computers will also be renamed in AD. The object will retain all its settings and join domain status but will display the new name.

Refer to some of the following articles:

  1. Discover 10 features of PowerShell
  1. 10 useful basic PowerShell commands for Windows
  1. About PowerShell

Good luck!

4 ★ | 18 Vote