对了,
我试图制作一个远程GPO脚本,从我们的pipe理机器中的一个将GPUPDATE命令推送到某些服务器。 一些Googlesearch后,我发现一个脚本,我试图适应/使运行。
然而,问题是,当我通过BATCH文件运行它时,在执行第9行时出现错误(公平地说,它不会错误,只是退出脚本)
通过pastebin链接到脚本: http : //pastebin.com/ugmC9uEr
脚本代码:
@echo on XPGPORef1=gpupdate.exe /Target:User /force XPGPORef2=gpupdate.exe /Target:Computer /force Win2kGPORef1=secedit.exe /refreshpolicy user_policy Win2kGPORef2=secedit.exe /refreshpolicy machine_policy For /f “Tokens=*” %%a in (ComputerList.txt) Do ( SET Comp_name=%%a Ver.exe \\%comp_name% > Hostver.txt Find /I “XP” < Hostver.txt > CheckCC.txt IF %errorlevel% == 0 ( Psexec.exe \\%comp_name% Gpupdate.exe /Target:User /force Psexec.exe \\%comp_name% Gpupdate.exe /Target:Computer /force ) ELSE ( Psexec.exe \\%comp_name% secedit.exe /refreshpolicy user_policy Psexec.exe \\%comp_name% secedit.exe /refreshpolicy machine_policy ) pause
如果我通过DOS提示符窗口手动运行第9行代码,例如执行以下操作:
For /f “Tokens=*” %a in (ComputerList.txt) Do ( echo %a)
它会运行得很好,并回显列表中的所有计算机名称。
任何人都介意给我一只手? 🙂
干杯
PS:这个脚本将尝试和GPUPDATE Win2k8 / Win2K3和Win2K电脑。
将这些服务器上的组策略刷新间隔降低到5-10分钟,而不是在所有服务器上执行远程gpupdate可能会更有好处。
我可以看到如何通过组策略远程获取机器更新设置的能力可能是有益的。 但远程做gpupdate的用户不会工作。 您需要在用户帐户的上下文中执行此操作。 我怀疑你的主要兴趣是计算机configurationgpupdate。
像http://www.specopssoft.com/products/specops-gpupdate这样的免费工具会有趣吗? 免责声明我没有使用它。