添加新的本地用户。
在CUI配置上,按如下方式设置。
Windows PowerShell 版权所由 (C) Microsoft Corporation。 保留所有权利。 安装最新的 PowerShell,了解新功能和改进!https://aka.ms/PSWindows # 例如,添加 [NC086] 用户 # [P@ssw0rd01] ⇒您设置的密码(根据需要替换) # [PasswordNeverExpires] ⇒设置密码永不过期(如果设置默认过期,则不指定此选项) PS C:\Users\Administrator> New-LocalUser -Name "NC086" ` -FullName "NC086" ` -Description "此计算机的管理员" ` -Password (ConvertTo-SecureString -AsPlainText "P@ssw0rd01" -Force) ` -PasswordNeverExpires ` -AccountNeverExpires Name Enabled Description ---- ------- ----------- NC086 True 此计算机的管理员 # 如果向用户授予权限,请将其添加到 [管理员] 组 PS C:\Users\Administrator> Add-LocalGroupMember -Group "Administrators" -Member "NC086" # 验证 PS C:\Users\Administrator> Get-LocalUser -Name NC086 Name Enabled Description ---- ------- ----------- NC086 True 此计算机的管理员 PS C:\Users\Administrator> Get-LocalGroupMember -Group "Administrators" ObjectClass Name PrincipalSource ----------- ---- --------------- User WIN-PA24S3GQ6G3\Administrator Local User WIN-PA24S3GQ6G3\NC086 Local # 如果删除用户,请执行如下操作 PS C:\Users\Administrator> Remove-LocalUser -Name "NC086"
复制
在GUI配置上,按如下方式设置。
如果出于某些原因(如安全性)想要更改管理员账户名称,可以进行如下更改。
在CUI配置上,按如下方式设置。
Windows PowerShell 版权所由 (C) Microsoft Corporation。 保留所有权利。 安装最新的 PowerShell,了解新功能和改进!https://aka.ms/PSWindows # 例如,将名称 [Administrator] 更改为 [NC086Admin] PS C:\Users\Administrator> Rename-LocalUser -Name "Administrator" -NewName "NC086Admin" PS C:\Users\Administrator> Get-LocalUser # changed Name Enabled Description ---- ------- ----------- DefaultAccount False A user account managed by the system. Guest False Built-in account for guest access to the computer/domain NC086 True 此计算机的管理员 NC086Admin True Built-in account for administering the computer/domain WDAGUtilityAccount False A user account managed and used by the system for Windows Defender Application Guard scenarios.
复制
在GUI配置上,按如下方式设置。
默认情况下,计算机名称是自动分配的,因此请更改它。
在CUI配置上,按如下方式设置。
Windows PowerShell 版权所由 (C) Microsoft Corporation。 保留所有权利。 安装最新的 PowerShell,了解新功能和改进!https://aka.ms/PSWindows # 例如,将“计算机名称”更改为 [NC086] PS C:\Users\Administrator> Rename-Computer -NewName NC086 -Force -PassThru HasSucceeded OldComputerName NewComputerName ------------ --------------- --------------- True WIN-VIMPQCFFRBH NC086 WARNING: The changes will take effect after you restart the computer WIN-VIMPQCFFRBH. # 例如,将主 DNS 后缀更改为 [ncncet.com] PS C:\Users\Administrator> Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\" –Name "NV Domain" –Value "ncncet.com" -PassThru NV Domain : ncncet.com PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\ PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip PSChildName : Parameters PSDrive : HKLM PSProvider : Microsoft.PowerShell.Core\Registry # 重新启动计算机以应用更改 PS C:\Users\Administrator> Restart-Computer -Force # 验证 PS C:\Users\Administrator> (ipconfig /all)[0..9] Windows IP Configuration Host Name . . . . . . . . . . . . : NC086 Primary Dns Suffix . . . . . . . : ncncet.com Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No DNS Suffix Search List. . . . . . : ncncet.com
复制
在GUI配置上,按如下方式设置。
默认情况下,IP地址由DHCP分配,因此请为服务器使用设置静态IP地址。此示例显示仅设置IPv4地址。
在CUI配置上,按如下方式设置。
Windows PowerShell 版权所由 (C) Microsoft Corporation。 保留所有权利。 安装最新的 PowerShell,了解新功能和改进!https://aka.ms/PSWindows # display network interfaces PS C:\Users\Administrator> Get-NetIPInterface -AddressFamily IPv4 ifIndex InterfaceAlias AddressFamily NlMtu(Bytes) InterfaceMetric Dhcp ConnectionState PolicyStore ------- -------------- ------------- ------------ --------------- ---- --------------- ----------- 11 Ethernet0 IPv4 1500 25 Enabled Connected ActiveStore 1 Loopback Pseudo-Interface 1 IPv4 4294967295 75 Disabled Connected ActiveStore # set DHCP off(将 InterfaceIndex 编号替换为您自己的环境(上面的 ifIndex)) PS C:\Users\Administrator> Set-NetIPInterface -InterfaceIndex 6 -Dhcp Disabled # 例如,设置 IP 地址 [192.168.200.101/24], gateway [192.168.200.1] PS C:\Users\Administrator> New-NetIPAddress -InterfaceIndex 11 -AddressFamily IPv4 -IPAddress "192.168.200.101" -PrefixLength 24 -DefaultGateway "192.168.200.1" IPAddress : 192.168.200.101 InterfaceIndex : 11 InterfaceAlias : Ethernet0 AddressFamily : IPv4 Type : Unicast PrefixLength : 24 PrefixOrigin : Manual SuffixOrigin : Manual AddressState : Preferred ValidLifetime : Infinite ([TimeSpan]::MaxValue) PreferredLifetime : Infinite ([TimeSpan]::MaxValue) SkipAsSource : False PolicyStore : ActiveStore # 例如,设置 DNS [192.168.200.1] PS C:\Users\Administrator> Set-DnsClientServerAddress -InterfaceIndex 11 -ServerAddresses "192.168.200.101" -PassThru InterfaceAlias Interface Address ServerAddresses Index Family -------------- --------- ------- --------------- Ethernet0 11 IPv4 {192.168.200.101} Ethernet0 11 IPv6 {} # 确认设置 PS C:\Users\Administrator> ipconfig /all Windows IP Configuration Host Name . . . . . . . . . . . . : NC086 Primary Dns Suffix . . . . . . . : ncncet.com Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No DNS Suffix Search List. . . . . . : ncncet.com Ethernet adapter Ethernet0: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Intel(R) 82574L Gigabit Network Connection Physical Address. . . . . . . . . : 00-0C-29-D9-45-D3 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::74:ecfd:e898:b756%7(Preferred) IPv4 Address. . . . . . . . . . . : 192.168.200.101(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.200.1 DHCPv6 IAID . . . . . . . . . . . : 100666409 DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-2D-E2-30-C2-00-0C-29-D9-45-D3 DNS Servers . . . . . . . . . . . : 192.168.200.1 NetBIOS over Tcpip. . . . . . . . : Enabled
复制
在GUI配置上,按如下方式设置。
配置 Windows 更新。
Windows 防火墙的默认设置会阻止ICMP,因此服务器永远不会使用ping命令从其他主机进行回复。如果要允许ICMP,请按如下方式设置。
在CUI配置上,按如下方式设置。
Windows PowerShell 版权所由 (C) Microsoft Corporation。 保留所有权利。 安装最新的 PowerShell,了解新功能和改进!https://aka.ms/PSWindows # 允许 ICMPv4 PS C:\Users\Administrator> New-NetFirewallRule ` -Name 'ICMPv4' ` -DisplayName 'ICMPv4' ` -Description 'Allow ICMPv4' ` -Profile Any ` -Direction Inbound ` -Action Allow ` -Protocol ICMPv4 ` -Program Any ` -LocalAddress Any ` -RemoteAddress Any # 确认设置 PS C:\Users\Administrator> Get-NetFirewallRule | Where-Object Name -Like 'ICMPv4' Name : ICMPv4 DisplayName : ICMPv4 Description : Allow ICMPv4 DisplayGroup : Group : Enabled : True Profile : Any Platform : {} Direction : Inbound Action : Allow EdgeTraversalPolicy : Block LooseSourceMapping : False LocalOnlyMapping : False Owner : PrimaryStatus : OK Status : The rule was parsed successfully from the store. (65536) EnforcementStatus : NotApplicable PolicyStoreSource : PersistentStore PolicyStoreSourceType : Local RemoteDynamicKeywordAddresses : {}
复制
在GUI配置上,按如下方式设置。
(:彩蛋,也有可能是缺你一个评论或点赞哦