以编程方式检查 Windows 7 是否已激活
背景: 我正在创建将加载到多个工作站的系统映像。 Windows 激活将在映像加载到工作站后进行。这些计算机不会连接到互联网,而是通过电话激活。
问题: 我想以编程方式检查Windows 7是否已激活,这样如果Windows 7未激活,我们的软件将无法运行。我们的软件是用 C# 编写的。
Background:
I am creating system images that will be loaded onto several workstations. Windows activation will occur after the images are loaded onto the workstation. These computers will not be connected to the Internet and will be activated over the phone.
Question:
I would like to check programmatically if Windows 7 is activated or not, so that our software will not run if Windows 7 is not activated. Our software is written in C#.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
软件许可 API - SLIAPI,看看
SLIsGenuineLocal()
。 (替换LegitCheck
< /a>)The Software Licensing API - SLIAPI, take at look at
SLIsGenuineLocal()
. (ReplacesLegitCheck
)您可以在计算机上运行“Slmgr.vbs”,然后重定向输出进行检查。
这将返回您需要的所有信息。但这不是最干净的方法。
You can run "Slmgr.vbs" on the machine and then redirect the output to check.
This will return all the information you need. Not the cleanest way to do it though.
您可以检查 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows Activation Technologies\AdminObject\Store\TotalValidations 并查看它是否为 1。这可能不是验证激活的最终方法,但您至少应该能够看到如果它被验证了。
You may check HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows Activation Technologies\AdminObject\Store\TotalValidations and see if it is 1. This may not be the definative way to verify activation, but you should at least be abel to see if it was validated.
您可以使用此参考:https://github.com/Marko97IT/CWA
在 README.md 中您可以找到下载链接。
You can use this reference: https://github.com/Marko97IT/CWA
In the README.md you can find the download link.
不确定它是否适用于Win7,但我 发现一篇文章,使用 Win32_WindowsProductActivation 类。
我将在我的机器(x64 Win7)上构建一个测试,看看它是否返回激活状态,但至少同时给你一些可以尝试的东西。编辑 (希望我继续阅读文档) 该类页面上的评论提到该类(在 Win 7 和其他版本上)似乎被替换为 软件许可类别。我会看看是否能得到工作结果。
Not sure if it applies to Win7, but I found a post that checks XP for activation using a Win32_WindowsProductActivation class.
I'll build a test one on my machine (x64 Win7) and see if it returns activated or not, but at least gives you something to try out in the mean time.EDIT (wish I kept reading the docs) A comment on that class page mentions that this class, on Win 7 and other versions) appears to be replaced with the Software Licensing Classes. I'll see if I can get a working result.