命令行強制開啟3389服務支持server2008和2003
1.C:\Windows\System32\wbem\wmic /namespace:\\root\cimv2\terminalservices path win32_terminalservicesetting where (__CLASS != "") call setallowtsconnections 1
2.C:\Windows\System32\wbem\wmic /namespace:\\root\cimv2\terminalservices path win32_tsgeneralsetting where (TerminalName ='RDP-Tcp') call setuserauthenticationrequired 1
3.reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fSingleSessionPerUser /t REG_DWORD /d 0 /f
4.net start TermService
C:\Windows\System32\wbem\wmic
win03 winxp 一條命令即可:
wmic path win32_terminalservicesetting where (__CLASS != "") call setallowtsconnections 1
使用cmd命令關閉防火牆
關閉防火牆:netsh firewall set opmode mode=disable
防火牆恢復默認配置:netsh firewall reset
在命令行模式下關閉Windows XP或Windows2003自帶的防火牆的四種命令:
netsh firewall set opmode mode=disable
ntsd -c q -p pid(先獲得PID)
ntsd -c q -pn xx.exe(防火牆進程)
net stop sharedaccess或net stop "windows firewall/internet connection sharing(ics)"
netsh命令
C:/>netsh
netsh>firewall
netsh firewall>show
下列指令有效:
命令從 netsh 上下文繼承:
show alias - 列出所有定義過的別名。
show helper - 請列出所有頭等助手。
show mode - 顯示當前的模式。
此上下文中的命令:
show allowedprogram - 顯示防火牆允許的程序配置。
show config - 顯示防火牆配置。
show currentprofile - 顯示當前防火牆配置文件。
show icmpsetting - 顯示防火牆 ICMP 配置。
show logging - 顯示防火牆記錄配置。
show multicastbroadcastresponse - 顯示防火牆多播/廣播響應配置。
show notifications - 顯示防火牆操作配置。
show opmode - 顯示防火牆端口配置。
show portopening - 顯示防火牆端口配置。
show service - 顯示防火牆服務配置。
show state - 顯示當前防火牆狀態。
CMD命令添加防火牆規則
比如想將ftp.exe加入防火牆規則(windows下通過ftp.exe向ftp服務器上傳文件,windows防火牆會彈出報警提示),cmd命令如下
>netsh advfirewall firewall add rule name="ftp.exe" dir=in program="C:\Windows\System32\ftp.exe" action=allow
當然執行這條命令的時候需要管理員權限。
windows server 2008 R2 命令行的方式如何創建用戶和設置密碼
一、使用命令行的方式創建用戶、設置密碼
打開命令提示符
net user username password / add
例如:建立一個名為lijunxuan、密碼為Abc_123的用戶
net user lijunxuan Abc_123 /add
二、使用命令行修改舊帳戶的密碼
net user username password
例如:將用戶lijunxuan的密碼設置為Abc_456
net user lijunxuan Abc_456
三、使用命令行的方式創建本地組
net localgroup groupname /add
例如:添加一個名為sales的組
net localgroup sales /add
四、使用命令行的方式為本地組
net localgroup groupname username /add
例如:將用戶名lijunxuan加入到administrators組中
net localgroup administrators lijunxuan / add
五、其他操作
net user abcd /del,將用戶名為abcd的用戶刪除。
net user abcd,查看用戶名為abcd的用戶的情況。
net user abcd /active:no,將用戶名為abcd的用戶禁用。
net user abcd /active:yes,激活用戶名為abcd的用戶。
