[問題] 一個 WMI 的問題

看板C_Sharp (C#)作者 (Green Island)時間20年前 (2005/08/03 21:05), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
我在網路上看到一個範例 它是用 WMI 來取得電腦的一些資訊 :比如硬碟 size 等等 我的的問題是 它只能抓到自己 localhost 端的資料 請問如果要自己指定 抓某台 IP 的資訊 該怎麼做呢 謝謝 網路範例如下 //Connection credentials to the remote computer - //not needed if the logged in account has access ConnectionOptions oConn = new ConnectionOptions(); //oConn.Username = "usename"; //oConn.Password = "password"; System.Management.ManagementScope oMs = new System.Management.ManagementScope("\\\\localhost", oConn); //get Fixed disk stats System.Management.ObjectQuery oQuery = new System.Management.ObjectQuery("select FreeSpace,Size,Name from Win32_LogicalDisk where DriveType=3"); ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oMs,oQuery); ManagementObjectCollection oReturnCollection = oSearcher.Get(); ----------------------------------------------------------------------- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.118.155.66

140.113.91.10 08/04, , 1F
localhost就是電腦名稱啊
140.113.91.10 08/04, 1F
文章代碼(AID): #12yC4rfq (C_Sharp)
文章代碼(AID): #12yC4rfq (C_Sharp)