在此处输入图像描述 在此处输入图像描述我对严肃的批处理文件还很陌生。但是我有一个问题,我确信可以通过编码解决。我负责保持 100 多个单位的产品密钥,当它们变坏时我们必须将它们更换,但有时它们不会重新密钥,所以我试图找到一种方法来跟踪未激活的窗口单位。
在你问不之前,我们没有批量许可服务器,或者任何与此相关的不幸。我的老板是老派。
所以我有一个代码:
@echo off
for /f %%i in (computers.txt) do shutdown -r -t 0 -m %%i// and that works fine and restarts all pcs i have in the .txt file in ip address form. then i run around trying to catch all the activation windows before they dissapear. but im trying to get it to check windows activation and output that to a text file with all the units that are NOT activated.
@echo off
for /f %%i in (computers.txt) do cscript /nologo c:\windows\system32\slmgr.vbs /xpr > ActivatedStatus.txt | findstr /i /c:" will expire "> NUL 2>&1
if [%errorlevel%]==[0] (echo Not permanently activated.) else (echo Permanently activated)
pause
exit /b
它工作正常并检查本地 pc 机,但我无法将命令推送到给定的一组 IP 地址。任何帮助将不胜感激。一直从这里借用代码片段来制作这个。认为是时候寻求帮助了。
如果您的目标操作系统是Windows 7
或更新,也许以下内容可以帮助您:
@Echo Off
Set "XSL=csv"
For /F "EOL=MDelims=" %%A In ('"WMIc OS Get MUILanguages,Version"'
) Do For /F Tokens^=2^,4-5Delims^=.^"^ %%B In ("%%A"
) Do If %%C Equ 6 If %%D Equ 1 Set "XSL=%__APPDIR__%WBEM\%%B\%XSL%
WMIC /Output:Results.log /Node:@Computers.txt Path SoftwareLicensingProduct^
Where "PartialProductKey Is Not Null And Name Like 'Windows(R)%%' And Not LicenseStatus='1'"^
Get LicenseStatus,Name,ProductKeyID /Format:"%XSL%"
这个想法是它会检查computers.txt
在当前工作目录中命名的文件中每行列出的每台计算机。如果Windows(R)
产品未显示为已许可,(即1
),它应该将一些相关信息输出到Results.log
也在您当前工作目录中命名的文件中。
许可证状态输出将转换为以下之一:
0
:未经许可
1
:已许可
2
:OOB 宽限期
3
:OOT 宽限期
4
: 非正版宽限期
5
: 通知
6
: 延长宽限期
注意:您可能不需要线3
-5
上面,如果你不从检查脚本的Windows 7
机器,我添加了那些因为与位置的已知问题的csv.xsl
文件对操作系统的版本。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句