如何以编程方式从 Windows 中检测双启动(特别是 Linux)?
我父亲正在寻找自动检查 Windows 服务器设置的方法,以赋予其标准合规性等级。他需要知道是否安装了多个操作系统,但希望不惜一切代价避免关闭服务器。 Windows(XP 和更高版本)中是否有任何技术可以通过编程方式确定计算机是否安装了多个操作系统?
My dad is looking for ways to automate checking the settings of a Windows server for giving it a standards compliance grade. He needs to know if more than one OS is installed, but wants to avoid taking down the server at all costs. Is there any technique within Windows (XP and newer) for programmatically ascertaining whether a machine has multiple OSs installed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这取决于您所认为的“已安装的操作系统”。
至少,您必须扫描所有分区(包括 Windows 有限文件系统支持无法识别的分区)中的文件系统,然后查看它们是否“看起来”像另一个操作系统。如果您需要知道备用操作系统是否也可启动,则还必须扫描启动加载程序及其配置。
顺便问一下,如果计算机上安装了其他操作系统,会有什么区别?
It depends on what you consider "an installed OS".
At the very least you'd have to scan all partitions (including the ones Windows's limited filesystem support can't recognize) for filesystems and then see if they "look" like another OS. If you need to know if the alternate OS is bootable as well, you'll have to scan for boot loaders and their configuration as well.
By the way, what difference does it make if there's another OS installed on the computer?
不完全可靠。如果您可以说服 Windows 让您将其他分区作为原始设备打开,您可以尝试访问 MBR 和分区表并嗅探竞争的证据。这将是一大堆工作。
Not entirely reliably. You could attempt to access the MBR and the partition table and sniff for evidence of the competition if you can persuade Windows to let you open the other partitions as raw devices. It would be a heap of work.
如何对引导加载程序进行校验和并将其与 HD 上已知良好的 Windows 操作系统引导加载程序列表进行比较?
How about doing a checksum of the bootloader and comparing it against a known-good list of Windows OS bootloaders on the HDs?