Summary of common Windows Server 2008 R2 server commands

  • 2020-05-15 02:54:41
  • OfStack

1. Change the computer name

Working group: Netdom RenameComputer %ComputerName% /NewName:08R2ServerCore

In the domain environment: Netdom RenameComputer %ComputerName% /Newname:08R2ServerCore /UserD:Administrator /PasswordD: P@ssw0rd

2. Set the IP address of the computer

Set the IP address to dynamic fetch: Netsh Interface ipv4 Set Address Name=" local connection "Source=DHCP

Set the IP address to 1 static IP: Netsh Interface ipv4 Set Address "local connection" Static 10.0.0.10 255.0.0.0 10.0.0.1

3. Set the DNS address

Netsh Interface ipv4 Set DNSServer "local connection" 202.96.209.133 index=1

4. Turn off the firewall

Netsh Firewall Set Opmode disable

5. Open firewall port 80

Netsh Firewall add portopening TCP 80 blah enable subnet

6. Add the computer to the domain

netdom join %computername% /domain: domain name /userd: domain name \ authorized user name /passwordd:*

7. Remove the computer from the domain

netdom remove %computername% /domain: domain name /userd: domain name \ authorized user name /passwordd:*

8. Restart and shut down the computer

Restart: shutdown /r /t 0

Shutdown: shutdown /s /t 0

9. Common view commands

See what you have installed: oclist

View computer information: systeminfo

See computer name: hostname

View current computer port usage: Netstat-na

View current port usage: Netstat-na | find "80"

View computer activation information: slmgr.vbs-did

10. Activate the command

Activate with a certain serial number: Slmgr /ipk 11111-22222-33333-44444-55555

Automatic activation: slmgr /ato

11. Users and groups

New user: net user Alice P @ssw0rd

Delete user: net user Alice /del

Change user password :net user Alice abc123,

New group: net localgroup SalesGroup

Add Alice to group SalesGroup: net localgroup SalesGroup Alice /add

Remove Alice from group SalesGroup: net localgroup SalesGroup Alice /del

12. Configure computer Web proxy address and port

netsh winhttp Set proxy 10.0.0.1:8080

ping is allowed or prohibited

Allow ping in: netsh firewall set icmpsetting 8

No ping: netsh firewall Set icmpsetting 8 disable

14. Install and uninstall roles:

Install DHCP: Start /w ocsetup DHCPServerCore

Uninstall DHCP: Start /w ocsetup DHCPServerCore /uninstall

Set to auto-start: sc config DHCPServer Start = auto

The names of other services can be viewed through: oclist

15. Upgrade to RODC

-- write one unattend.txt file first, copy the following into the file and store it in C disk --

[DCInstall]

InstallDNS=Yes

ConfirmGC=No

CriticalReplicationOnly=Yes

DisableCancelForDnsInstall=no


ReplicaDomainDNSName=contoso.com

ReplicaOrNewDomain=ReadOnlyReplica

ReplicationSourceDC=server8.contoso.com

SafeModeAdminPassword=abc123,

SiteName=Default-First-Site-Name

UserDomain=contoso.com

UserName=administrator

Password=P@ssw0rd

-------------------------------------

Then type on the command line:

dcpromo /unattend:"c:\unattend.txt"


Related articles: