以下是将您提供的笔记整理为 Markdown 格式的内容:


Windows 系统管理命令笔记

1. SNMP 组件安装

方法一:使用 DISM

dism /online /add-capability /capabilityname:snmp.client~~~~0.0.1.0

方法二:使用 PowerShell

# 获取 SNMP SERVICE 全名
Get-WindowsCapability -Online -Name "*SNMP*"

# 安装 SNMP SERVICE
Add-WindowsCapability -Online -Name "SNMP.Client~~~~0.0.1.0"
Add-WindowsCapability -Online -Name "WMI-SNMP-Provider.Client~~~~0.0.1.0"

# 检查安装情况
Get-WindowsCapability -Online -Name "SNMP*"

2. SMB 支持开启

开启 SMB1 协议

Dism /online /Enable-Feature /FeatureName:SMB1Protocol
start /w pkgmgr /iu:SMB1Protocol;SMB1Protocol-Client;SMB1Protocol-Server;SMB1Protocol-Deprecation

3. 防火墙配置

NetSh Advfirewall set allprofiles state off

4. 网络配置

  • 网络接口添加拨号 toali
  • 在静态路由中添加 0.0.0.0 的路由到 toali

5. 系统信息查看

内存信息

wmic os get TotalVisibleMemorySize,FreePhysicalMemory

资产号、序列号、是否为虚拟机/物理机

Windows

wmic bios get serialnumber,Manufacturer,Status

CentOS

dmidecode | grep "Serial Number*"

服务器编号

Windows

wmic bios get serialnumber

Linux

dmidecode | grep -i "Serial number"

ESXi

esxcfg-info | grep "Serial Number"

系统启动时间

wmic path Win32_OperatingSystem get LastBootUpTime

6. 用户管理(远程 Win7 示例)

net user hxsd Hxsd598377 /add 
net user hxsd1 Hxsd598388 /add 
net localgroup "Remote Desktop Users" hxsd /add

密码永不过期

wmic UserAccount where "Name='username'" set PasswordExpires=False
wmic useraccount where name="hxsdbk" set PasswordExpires=FALSE

7. 进程内存占用监控(钉钉示例)

set sun=0
for /f %i in ('wmic process where name^="DingTalk.exe" get PeakWorkingSetSize ^| findstr /v "Peak"') do ( set /a sun=sun+%i)
set /a suna=%sun%/1024
echo %date% %time% %computername% DingTalk占用内存: %suna%MB

8. 系统信息输出到网络共享

wmic path Win32_OperatingSystem get LastBootUpTime >> \\10.2.1.99\NETLOGON\a.txt
echo %computername% >> \\hxsddc5\NETLOGON\a.txt

wmic logicaldisk where mediatype='12' Get deviceID,size,FreeSpace | find ":" >> \\hxsddc5\NETLOGON\a.txt
wmic os get TotalVisibleMemorySize,FreePhysicalMemory >> \\hxsddc5\NETLOGON\a.txt

9. MAC 地址与文件操作

# 查看 MAC 地址
for /f %i in ('wmic nic where netconnectionid!^=NULL get macaddress ^| find /i ":"') do (echo %i)

# 根据 MAC 地址复制配置文件
for /f %i in ('getmac ^| find /i "-"') do (copy C:\qskg\qskg.config \\10.2.20.227\data\z\conf\%i.txt)
for /f %i in ('getmac ^| find /i "-"') do (echo y | copy \\10.2.20.227\data\z\conf\%i.txt C:\qskg\qskg.config)

10. 网络与磁盘信息收集

ipconfig | findstr /i "IPv4 address" >> \\10.2.20.227\data\z\0716\bjwin.txt
wmic logicaldisk where mediatype='12' Get deviceID,size,FreeSpace | find ":" >> \\10.2.20.227\data\z\0716\bjwin.txt
wmic os get TotalVisibleMemorySize,FreePhysicalMemory >> \\10.2.20.227\data\z\0716\bjwin.txt
wmic cpu get loadpercentage

11. 桌面图标与系统激活

# 打开桌面图标设置
rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0

# 查看激活信息
slmgr.vbc -dlv

# 激活报错修复(非内核)
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform" /v SkipRearm /t REG_DWORD /d 1 /f

如果需要进一步分类或添加说明,我可以继续优化这份笔记。

标签: none

添加新评论