最近针对服务器要集中操作,稍微研究了一下power shell,发现这个东西真的是管理员居家旅行杀人灭口的必备工具啊...
比如针对一组服务器调整防火墙可信IP范围,只需要敲
Invoke-Command -ComputerName ("server1","server3","server4","server5","server6","server7","server8","server9","server10","server11") -ScriptBlock {Get-NetFirewallRule | ?{ $_.DisplayName -like "PCNS*" } | Set-NetFirewallRule -RemoteAddress ("192.168.15.101-192.168.15.111", "192.168.15.20", "192.168.15.11", "192.168.18.168", "192.168.18.115","192.168.15.19","10.0.0.101-10.0.0.111")}
真是超级简单易懂。
时隔五年的新随笔,人生还是要继续学习一个呀。撒花~