{"id":244129,"date":"2022-06-15T10:34:41","date_gmt":"2022-06-15T02:34:41","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=244129"},"modified":"2022-05-31T20:37:57","modified_gmt":"2022-05-31T12:37:57","slug":"vbs-maccpuid-linux","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/vbs-maccpuid-linux.html","title":{"rendered":"\u6559\u4f60\u7528vbs\u811a\u672c\u83b7\u53d6\u7f51\u5361MAC,CPUID,\u786c\u76d8\u5e8f\u5217\u53f7\u7684\u5b9e\u73b0\u4ee3\u7801"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u4e86\u7528vbs\u811a\u672c\u83b7\u53d6\u7f51\u5361MAC,CPUID,\u786c\u76d8\u5e8f\u5217\u53f7\u7684\u5b9e\u73b0\u4ee3\u7801,\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u8fd9\u91cc\u5148\u7ed9\u5927\u5bb6\u5206\u4eab\u4e00\u4e2a\u5206\u914d\u9759\u6001ip\u5730\u5740\u7684\u4ee3\u7801<\/strong><\/span><\/div>\n
\r\n' Assign a Static IP Address\r\n \r\n \r\nstrComputer = \".\"\r\nSet objWMIService = GetObject(\"winmgmts:\" _\r\n  & \"{impersonationLevel=impersonate}!\\\\\" & strComputer & \"\\root\\cimv2\")\r\n \r\nSet colNetAdapters = objWMIService.ExecQuery _\r\n  (\"Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE\")\r\n \r\nstrIPAddress = Array(\"192.168.6.98\")\r\nstrSubnetMask = Array(\"255.255.255.0\")\r\nstrGateway = Array(\"192.168.6.1\")\r\nstrGatewayMetric = Array(1)\r\n  \r\nFor Each objNetAdapter in colNetAdapters\r\n  errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)\r\n  errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)\r\n  If errEnable = 0 Then\r\n    WScript.Echo \"The IP address has been changed.\"\r\n  Else\r\n    WScript.Echo \"The IP address could not be changed.\"\r\n  End If\r\nNext<\/pre>\n
\u68c0\u6d4bU\u76d8 \u65b9\u6cd5\u4e00<\/strong><\/span><\/div>\n
\r\n'\u65b9\u6cd51\r\nSub\u2002Auto_Open()\r\nOn\u2002Error\u2002Resume\u2002Next\r\n\u2002\u2002\u2002\u2002Set\u2002fs\u2002=\u2002CreateObject(\"Scripting.FileSystemObject\")\r\n\u2002\u2002\u2002\u2002StrDrive\u2002=\u2002\"B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z\"\r\n\u2002\u2002\u2002\u2002StrDriveArray\u2002=\u2002Split(StrDrive,\u2002\",\")\r\n\u2002\u2002\u2002\u2002For\u2002StartPos\u2002=\u20021\u2002To\u2002UBound(StrDriveArray)\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002Set\u2002d\u2002=\u2002fs.GetDrive(fs.GetDriveName(fs.GetAbsolutePathName(StrDriveArray(StartPos)\u2002&\u2002\":\\\\\")))\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002If\u2002d.DriveType\u2002=\u20021\u2002Then\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002s\u2002=\u2002d.SerialNumber\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002Exit\u2002For\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002End\u2002If\r\n\u2002\u2002\u2002\u2002Next\r\n\u2002\u2002\u2002\u2002If\u2002s\u2002<>\u2002\"\"\u2002Then\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002Range(\"Sheet1!d8\")\u2002=\u2002s\r\n\u2002\u2002\u2002\u2002Else\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002Range(\"Sheet1!d8\")\u2002=\u2002\"\u7cfb\u7edf\u672a\u68c0\u6d4b\u5230U\u76d8\uff01\"\r\n\u2002\u2002\u2002End\u2002If\r\n\u2002\u2002\u2002Set\u2002d\u2002=\u2002Nothing\r\n\u2002\u2002\u2002Set\u2002fs\u2002=\u2002Nothing\r\n\u2002\u2002\u2002Call\u2002QueryOther\r\nEnd\u2002Sub\r\n'\u65b9\u6cd52\r\nSub\u2002DetectUdisk()\r\nOn\u2002Error\u2002Resume\u2002Next\r\n\u2002\u2002\u2002\u2002Set\u2002objWMIService\u2002=\u2002GetObject(\"winmgmts:\\\\.\\root\\cimv2\")\r\n\u2002\u2002\u2002\u2002Set\u2002colDisks\u2002=\u2002objWMIService.ExecQuery(\"Select\u2002*\u2002from\u2002Win32_LogicalDisk\u2002Where\u2002DriveType\u2002=\u20022\")\r\n\u2002\u2002\u2002\u2002For\u2002Each\u2002objDisk\u2002In\u2002colDisks\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002RemovableDrive\u2002=\u2002objDisk.DeviceID\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002If\u2002CreateObject(\"Scripting.FileSystemObject\").GetDrive(RemovableDrive).IsReady\u2002Then\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002s\u2002=\u2002CreateObject(\"Scripting.FileSystemObject\").GetDrive(RemovableDrive).SerialNumber\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002Exit\u2002For\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002End\u2002If\r\n\u2002\u2002\u2002\u2002Next\r\n\u2002\u2002\u2002\u2002If\u2002s\u2002<>\u2002\"\"\u2002Then\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002Range(\"Sheet1!d8\")\u2002=\u2002s\r\n\u2002\u2002\u2002\u2002Else\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002Range(\"Sheet1!d8\")\u2002=\u2002\"\u7cfb\u7edf\u672a\u68c0\u6d4b\u5230U\u76d8\uff01\"\r\n\u2002\u2002\u2002End\u2002If\r\n\u2002\u2002\u2002Call\u2002QueryOther\r\nEnd\u2002Sub\r\nSub\u2002QueryOther()\r\n\u2002\u2002\u2002'2007.1.19\u2002\u66f4\u65b0\uff0c\u83b7\u53d6\u4e3b\u677f\u5e8f\u5217\u53f7,\u2002CPUID,\u2002\u7f51\u5361MAC\u5730\u5740\r\n\u2002\u2002\u2002\u2002Set\u2002objWMIService\u2002=\u2002GetObject(\"winmgmts:\\\\.\\root\\cimv2\")\r\n\u2002\u2002\u2002\u2002Set\u2002colItems\u2002=\u2002objWMIService.ExecQuery(\"Select\u2002\u2002\u2002SerialNumber\u2002\u2002\u2002From\u2002\u2002\u2002Win32_BIOS\")\r\n\u2002\u2002\u2002\u2002For\u2002Each\u2002objItem\u2002In\u2002colItems\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002Range(\"Sheet1!E8\")\u2002=\u2002objItem.SerialNumber\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002Exit\u2002For\r\n\u2002\u2002\u2002\u2002Next\r\n\u2002\u2002\u2002\u2002Set\u2002colItems\u2002=\u2002Nothing\r\n\u2002\u2002\u2002\u2002\r\n\u2002\u2002\u2002\u2002Set\u2002colItems\u2002=\u2002objWMIService.ExecQuery(\"Select\u2002*\u2002from\u2002Win32_Processor\")\r\n\u2002\u2002\u2002\u2002For\u2002Each\u2002objItem\u2002In\u2002colItems\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002Range(\"Sheet1!F8\")\u2002=\u2002objItem.ProcessorId\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002Exit\u2002For\r\n\u2002\u2002\u2002\u2002Next\r\n\u2002\u2002\u2002\u2002Set\u2002colItems\u2002=\u2002Nothing\r\n\u2002\u2002\u2002\u2002\r\n\u2002\u2002\u2002\u2002Set\u2002colItems\u2002=\u2002objWMIService.ExecQuery(\"SELECT\u2002MACAddress\u2002FROM\u2002Win32_NetworkAdapter\u2002WHERE\u2002((MACAddress\u2002Is\u2002Not\u2002NULL)\u2002AND\u2002(Manufacturer\u2002<>\u2002'Microsoft'))\")\r\n\u2002\u2002\u2002\u2002For\u2002Each\u2002objItem\u2002In\u2002colItems\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002Range(\"Sheet1!G8\")\u2002=\u2002objItem.MACAddress\r\n\u2002\u2002\u2002\u2002\u2002\u2002\u2002\u2002Exit\u2002For\r\n\u2002\u2002\u2002\u2002Next\r\n\u2002\u2002\u2002\u2002Set\u2002colItems\u2002=\u2002Nothing\r\n\u2002\u2002\u2002\r\nEnd\u2002Sub<\/pre>\n

\u597d\u4e86\uff0c\u8fd9\u91cc\u5c31\u5148\u4ecb\u7ecd\u5230\u8fd9\uff0c\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e00\u4e0b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

‘ Assign a Static IP Address strComputer = “.” Set objW […]<\/p>\n","protected":false},"author":1482,"featured_media":241794,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-244129","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/244129","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1482"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=244129"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/244129\/revisions"}],"predecessor-version":[{"id":244133,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/244129\/revisions\/244133"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/241794"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=244129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=244129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=244129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}