Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the administrative commands of Windows Server 2008

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Windows Server 2008 management command is what, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

A skilled server administrator with a certain technical depth, they often abandon the friendly graphical interface and choose to use commands to manage the server. This can not only improve work efficiency, but also achieve many tasks that cannot be accomplished in the graphical interface under the command line. This is especially true for server operating systems such as Windows Server 2008, where good use of commands liberates administrators to a large extent. Below, the author introduces several commands that are very useful in Server 2008.

1. Server management with ServerManagerCMD command

ServerManagerCMD is a command-line tool for server manager that supports three important operations: adding and removing roles, role services, functions, and displaying installed roles, role services, and functions. For specific parameters, you can enter "ServerManagerCMD /?" under the command line. To check it out. Among them,-query,-install, and-remove are the three most commonly used parameters, which users query, install and delete server roles, role services, and functions, respectively. Below, the author demonstrates the usage of these three parameters.

(1)。 Query

Enter the command "ServerManagerCMD-query" in the command prompt window, and you can enter to view the configuration and functions of the server, thus eliminating the need to switch back and forth in the graphical interface of the Service Manager. The display result is clear at a glance: roles and functions will be divided into two groups, and installed roles, role services, and features will be displayed in green and marked with [X] in front of the item, and those that are not installed will be marked as [] in front of white. As shown in figure 1, the server roles installed by the author's server are: Active Directory domain service, DNS server, Windows deployment service, and the installed functional components are: TFTP client, group policy manager. In addition, the installed role service is displayed in a hierarchy under the role for. (figure 1)

The author also has a tip to share with you: when the server has installed multiple roles, role services, and functional components, it will be troublesome if the administrator wants to see if an object is installed. In fact, ServerManagerCMD-query supports the pipe command "|". We can do this: if we want to check whether the server has a group policy management component, we can type "ServerManagerCmd.exe-query | GPMC" at the command line. If we install this component, we will open the tool, otherwise an error prompt will be displayed (for example, enter the command "ServerManagerCmd.exe-query | RSAT-TS" to check whether the terminal services tool is installed. Because no installation will output an error). (figure 2)

(2)。 Installation

Windows Server 2008 does not have the telnet client installed by default. If we want to install this feature, we can enter the command "ServerManagerCmd.exe-install Telnet-Client-resultPath installResult.xml" at the command prompt and enter. At this point, the installation of the Telnet-Client feature components begins, and the progress (percentage) of the installation is displayed in real time, and the installation is completed soon. In the above command, "Telnet-Client" is the system name of the Telnet client, and the name must be in English and not in Chinese, otherwise "invalid role, role service or function" will be displayed. Of course, it should not be difficult for a skilled server administrator to remember these names. If you forget, you can check it with the query command "ServerManagerCmd.exe-query" above. The function of the "- resultPath installResult.xml" parameter is to save the result of the operation to the installResult.xml file in XML format. In addition, if the installation role needs to restart the computer, we can add a parameter "- restart" after the installation to automatically restart the system after the installation to make the installation take effect. (figure 3)

(3)。 Delete

To delete a server role, role service, or functional component that is similar to the one above, simply change the parameters of the ServerManagerCmd.exe command. For example, if we want to delete both the "Windows deployment Service" role and the "TFTP client" feature, enter the command "ServerManagerCMD-remove WDS TFTP-Client" at the command prompt and enter. Then start the deletion and display the deletion progress, and wait a moment to complete the deletion task. If you want to delete more roles or functions, simply enter the names of the roles or functions in turn and separate them with spaces, which is much faster than the operation in the graphical interface. (figure 4)

2. Quickly configure server components

The configuration of the server is not only technical, but sometimes manual. How does the server administrator realize the rapid configuration of the server in order to improve work efficiency and self-liberation? Make good use of commands and scripts this is a set of immediate solutions, the following author lists a few practical cases.

(1)。 Configure the firewall

Firewall configuration is not only an important aspect of server security deployment, but also a tedious work. Especially for the server platform such as Windows Server 2008, its system firewall function is very powerful and there are many configurable items. Here are some useful commands and a configuration example.

Open the command prompt and enter the command "netsh firewall show state" and then enter to view the status of the firewall. From the display results, you can see the disabled and enabled status of each function module of the firewall. The command "netsh firewall set opmode disable" is used to disable the system firewall, while the command "netsh firewall set opmode enable" enables the firewall. (figure 5)

Next we configure the firewall from the command line to allow access to file and print shares as well as DNS queries. Open the command prompt and enter the command "netsh firewall add portopening UDP 53 DNS-Server" and enter. After the command is executed, the server will be able to respond to the client's DNS query request and provide it with DNS services. A simple command is done. Let's use commands to enable the client to access the server through file and print sharing. Enter and execute the following commands: "netsh firewall add portopening UDP 137Netbios-ns" (allowing client access to port 137of the server UDP protocol), "netsh firewall add portopening UDP 138Netbios-dgm" (allowing access to port 138of the UDP protocol), "netsh firewall add portopening TCP 139Netbios-ssn" (allowing access to port 139of the TCP protocol), "netsh firewall add portopening TCP 445Netbios-ds" (allowing access to port 445of the TCP protocol). After the execution of the command, the ports required for file and print sharing were released by the firewall, and we tried to access it from the client. Although there are many commands above, the similar format is also very easy to remember. (figure 6)

(2)。 Application of script in Server Core

Server Core is a minimally installed server version that discards the gorgeous features of Windows Server 2008, and Server Core cannot be configured without a command line and scripts. Execute "cd cd c:windowssystem32" from the command line to go to the system32 directory, type "cscript SCregEdit.wsf / di" and enter, and all the common commands for configuring Server Core will be listed without the administrator having to fumble. Among them, SCregEdit.wsf is a Server Core-specific script that has many parameters for administrators to use. Enter "Cscript slmgr.vbs-dlv" to display the authorization status of the server. If we want to enable remote Desktop under Server Core, we can first open the command to jump to the system32 path and then execute the command "cscript SCregEdit.wsf / Ar 0" to enable remote Desktop. Next, you need to configure the firewall to open the port used by the remote desktop and execute the name "netsh firewall add portopening TCP 3389 Remote-Desktop". Script is a very useful resource in Server Core, and you should dig and make good use of it. (figure 7)

(3)。 Other scripts and command line tools

There is also a powerful command line tool PowerShell in Windows Server 2008, which is far more operable to server systems than CMD. The PowerShell feature component is not installed by default, and we can use the

ServerManagerCmd.exe command to install, that is, run "ServerManagerCmd.exe-install PowerShell". After the installation is complete, execute "start" → "all programs" → "Windows PowerShell 1.0" → "Windows PowerShell" to run PowerShell. Run "get-command | more" and get all the PowerShell commands and display them in split screens. The PowerShell command consists of two parts, which are very readable, and the administrator can guess the role of the command with the same name. For example, if we want to access the registry in PowerShell, we can execute "cd-path hklm:" to enter the registry HKEY_LOCAL_MACHINE primary key path, continue to execute "dir" to display the subkeys under the HKLM primary key, execute "cd SoftwareMicrosoftWindowsCurrentVersionRun" to enter the system self-startup key, and execute "gp." * "the properties of the RUN entry and the following key values will be displayed, and the attributes of the first four bits of the RUN item in the result will be output, based on which the administrator can analyze whether the startup item is normal. Secondly, for example, we enter the commands "Get-Process | Out-File-FilePath C:process.txt" and "Get-Service | Out-File-FilePath C:srver.txt" under the PowerShell command line to output the current process of the server and its service status to a file, which can be compared in future server maintenance. In fact, PowerShell is a tool that can completely replace CMD, through which almost all system operations can be completed. In-depth study of PowerShell is indeed very useful to improve management efficiency. (figure 8)

In addition, WinRM is a very useful management tool. Using WinRM for remote server management can reduce insecure and tedious RPC connections by using HTTP or HTTPS, which is useful for scenarios that manage across firewalls. First execute "WinRM QuickConfig" from the command line, and then enter "y" to enable WinRM remote management. Then continue to execute the command "WINRM Enum Winrm/Config/Listener" to see the listening configuration on the server, as shown in figure 9, port 80 of http is listening, so that the server can be managed through the client's browser. WMI is also a server management tool available to administrators. In practice, WMI scripts are written to represent administrators to complete some repetitive and massive operations that require a lot of effort. (figure 9)

3. Get server details

For the server, management and monitoring go hand in hand. Server managers need to know the software and hardware of the server and its running status at any time, which can be realized on the command line without the help of third-party tools in Windows Server 2008.

By executing the systeminfo.exe command from the command line, you can see detailed information about the operating system and its server hardware, and of course the systeminfo.exe command and deployment of Windows Server 2008 is unique. If we want to know all the msi applications installed on the server, we can first open the command prompt and enter the command wmic to enter its command mode, then execute the product command to display the results you want. If you want to uninstall an installed msi application, you can call the uninstall method of product with the command format of WMIC product where name= "" call uninstall. Of course, the well-known tasklist, net share, net server and so on are all commands for us to obtain server information. In fact, we can borrow the relevant commands in PowerShell to get more detailed server information. Almost all commands prefixed with "get" in PowerShell are related to getting server information, such as "get-date" to get the current system date, "Get-EventLog" to get server log information, "Get-PSDrive" to get system partition information, and so on. (figure 10)

The quality of server management is important, but so is efficiency. They are not contradictory but promote each other. As a server manager, managing through commands will undoubtedly greatly improve the efficiency of management, especially for server platforms such as Windows Server 2008.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report