我需要检查是否在服务器上禁用了 IPv6。我的脚本无法启用或禁用它,只需检查一下。
我在不久前发表了这篇文章,VBScript 子例程检查注册表中的 IPv6 状态...返回 -1,我一直在使用这个逻辑,它一直运行良好。今天我遇到了一个问题,我得到了一个假阴性。适配器上的 IPv6 复选框未选中,我的代码逻辑(在我粘贴的链接中)没有检查,“DisabledComponents”键甚至不存在。
我已经搜索了几个小时,但找不到任何知道默认网络适配器是否启用 IPv6 的方法。我会很好地遍历所有网络适配器,但 WMI 网络适配器中没有一个属性可以告诉我是否启用了 IPv6。
不幸的是,我不知所措...
有什么建议么?
PS我的代码在链接中
编辑:Rene 解决方案的输出
SYSTEM\CurrentControlSet\services\TCPIP6\Parameters\ no disabled components
\Device\{5EB82563-B53C-487C-9071-2FFEEF3ACFFD} = \Device\{5EB82563-B53C-487C-9071-2FFEEF3ACFFD}
\Device\{C22E58F2-C979-4CAE-8B15-73DFE86E8961} = \Device\{C22E58F2-C979-4CAE-8B15-73DFE86E8961}
\Device\{F2E73C76-C023-492D-8A14-824233F953F9} = \Device\{F2E73C76-C023-492D-8A14-824233F953F9}
\Device\{7D754194-9C49-44C4-9D39-5C5CE1A79EE2} = \Device\{7D754194-9C49-44C4-9D39-5C5CE1A79EE2}
\Device\{07F7960F-D1A0-408C-8BDB-88FE296F0BB2} = \Device\{07F7960F-D1A0-408C-8BDB-88FE296F0BB2}
\Device\{8D600902-D19B-462B-995B-C79EDB9BD9C7} = \Device\{8D600902-D19B-462B-995B-C79EDB9BD9C7}
\Device\{5E848319-EF8D-46F2-863E-A11BA9033FB0} = \Device\{5E848319-EF8D-46F2-863E-A11BA9033FB0}
\Device\{98EC2BBC-2FC1-4FD7-A925-7DE3F17ECC50} = \Device\{98EC2BBC-2FC1-4FD7-A925-7DE3F17ECC50}
\Device\{5EB82563-B53C-487C-9071-2FFEEF3ACFFD} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{5EB82563-B53C-487C-9071-2FFEEF3ACFFD}
\Device\{C22E58F2-C979-4CAE-8B15-73DFE86E8961} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{C22E58F2-C979-4CAE-8B15-73DFE86E8961}
\Device\{F2E73C76-C023-492D-8A14-824233F953F9} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{F2E73C76-C023-492D-8A14-824233F953F9}
\Device\{7D754194-9C49-44C4-9D39-5C5CE1A79EE2} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{7D754194-9C49-44C4-9D39-5C5CE1A79EE2}
\Device\{07F7960F-D1A0-408C-8BDB-88FE296F0BB2} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{07F7960F-D1A0-408C-8BDB-88FE296F0BB2}
\Device\{8D600902-D19B-462B-995B-C79EDB9BD9C7} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{8D600902-D19B-462B-995B-C79EDB9BD9C7}
\Device\{5E848319-EF8D-46F2-863E-A11BA9033FB0} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{5E848319-EF8D-46F2-863E-A11BA9033FB0}
\Device\{98EC2BBC-2FC1-4FD7-A925-7DE3F17ECC50} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{98EC2BBC-2FC1-4FD7-A925-7DE3F17ECC50}
\Device\{9E85E61A-EBB4-40E0-BB55-31FE48973DD2} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{9E85E61A-EBB4-40E0-BB55-31FE48973DD2}
\Device\{4E0B9F15-E1C9-4093-A929-419BE1B089FB} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{4E0B9F15-E1C9-4093-A929-419BE1B089FB}
\Device\{4974F3E4-7493-428A-8DD4-3A43F64ACA00} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{4974F3E4-7493-428A-8DD4-3A43F64ACA00}
\Device\{C6E0B4F3-BC2C-49D7-9178-41F6F9C75C94} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{C6E0B4F3-BC2C-49D7-9178-41F6F9C75C94}
\Device\{8BE42170-83DC-4A40-880A-3163A88D8540} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{8BE42170-83DC-4A40-880A-3163A88D8540}
\Device\{8EBA3452-69B1-4284-A859-58B9C3A2735B} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{8EBA3452-69B1-4284-A859-58B9C3A2735B}
\Device\{046E21CF-38BB-447B-81F1-12536E4260DE} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{046E21CF-38BB-447B-81F1-12536E4260DE}
\Device\{FB30DEEC-3A32-47FF-A8CC-EBFB112D29C2} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{FB30DEEC-3A32-47FF-A8CC-EBFB112D29C2}
\Device\{72A0EBC4-11EE-4A57-8F4E-9771264B7C74} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{72A0EBC4-11EE-4A57-8F4E-9771264B7C74}
\Device\{767698C6-D554-4EFF-8D15-9F2F6BDA5FD3} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{767698C6-D554-4EFF-8D15-9F2F6BDA5FD3}
\Device\{CE60A593-435C-40C3-8D2D-F48D00F743B6} {5E848319-EF8D-46F2-863E-A11BA9033FB0} = {5E848319-EF8D-46F2-863E-A11BA9033FB0}\Device\{CE60A593-435C-40C3-8D2D-F48D00F743B6}
...
它包括更多,但我只粘贴了一个片段。