.txt 与 Windows 激活(批处理文件)

大卫·韦弗

在此处输入图像描述 在此处输入图像描述我对严肃的批处理文件还很陌生。但是我有一个问题,我确信可以通过编码解决。我负责保持 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] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

批处理文件以检查Windows激活状态

来自分类Dev

仅保留 txt 文件中包含某个单词/字符的行(Powershell)(Windows 批处理文件)

来自分类Dev

Windows批处理文件将一个文件夹中的文件列出到csv/txt文件中

来自分类Dev

如何在Windows7中使用批处理文件将.txt连接到.bin文件

来自分类Dev

批处理文件写入txt

来自分类Dev

如何创建Windows批处理文件,在每个目录中递归地合并所有* NAD.TXT?

来自分类Dev

Windows批处理文件处理-循环

来自分类Dev

Windows批处理文件处理-循环

来自分类Dev

从GNUMakeFile调用Windows批处理文件

来自分类Dev

Windows curl批处理文件

来自分类Dev

Windows批处理文件-ipconfig / skype

来自分类Dev

多行Windows批处理文件问题

来自分类Dev

Windows批处理文件Modulo划分

来自分类Dev

Windows批处理文件执行错误

来自分类Dev

使用批处理文件在.txt文件中搜索双字

来自分类Dev

批处理文件以使用.txt列表

来自分类Dev

批处理文件以在Windows中运行其他批处理文件

来自分类Dev

Windows添加空行以开始txt批处理

来自分类Dev

Windows批处理文件无法找到文件

来自分类Dev

Windows批处理文件:复制顺序文件

来自分类Dev

Windows批处理文件以自动压缩文件

来自分类Dev

使用Windows批处理文件删除重复的文件

来自分类Dev

使用powershell编辑Windows批处理文件中的文件

来自分类Dev

批处理文件-无法将文本从Java打印到.txt。通过使用批处理编程

来自分类Dev

使用批处理文件设置Windows环境变量

来自分类Dev

Windows启动命令无法执行批处理文件

来自分类Dev

Windows批处理文件中的日期解析

来自分类Dev

您可以派生Windows批处理文件吗?

来自分类Dev

避免在Windows批处理文件的for循环中打印

Related 相关文章

  1. 1

    批处理文件以检查Windows激活状态

  2. 2

    仅保留 txt 文件中包含某个单词/字符的行(Powershell)(Windows 批处理文件)

  3. 3

    Windows批处理文件将一个文件夹中的文件列出到csv/txt文件中

  4. 4

    如何在Windows7中使用批处理文件将.txt连接到.bin文件

  5. 5

    批处理文件写入txt

  6. 6

    如何创建Windows批处理文件,在每个目录中递归地合并所有* NAD.TXT?

  7. 7

    Windows批处理文件处理-循环

  8. 8

    Windows批处理文件处理-循环

  9. 9

    从GNUMakeFile调用Windows批处理文件

  10. 10

    Windows curl批处理文件

  11. 11

    Windows批处理文件-ipconfig / skype

  12. 12

    多行Windows批处理文件问题

  13. 13

    Windows批处理文件Modulo划分

  14. 14

    Windows批处理文件执行错误

  15. 15

    使用批处理文件在.txt文件中搜索双字

  16. 16

    批处理文件以使用.txt列表

  17. 17

    批处理文件以在Windows中运行其他批处理文件

  18. 18

    Windows添加空行以开始txt批处理

  19. 19

    Windows批处理文件无法找到文件

  20. 20

    Windows批处理文件:复制顺序文件

  21. 21

    Windows批处理文件以自动压缩文件

  22. 22

    使用Windows批处理文件删除重复的文件

  23. 23

    使用powershell编辑Windows批处理文件中的文件

  24. 24

    批处理文件-无法将文本从Java打印到.txt。通过使用批处理编程

  25. 25

    使用批处理文件设置Windows环境变量

  26. 26

    Windows启动命令无法执行批处理文件

  27. 27

    Windows批处理文件中的日期解析

  28. 28

    您可以派生Windows批处理文件吗?

  29. 29

    避免在Windows批处理文件的for循环中打印

热门标签

归档