资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

vb.net获取计算机域的简单介绍

vb.net访问局域网指定计算机上的文件

如果你有该永动机的登陆用户名和密码.那简单了.

创新互联建站是一家专注于成都网站建设、成都网站设计与策划设计,博兴网站建设哪家好?创新互联建站做网站,专注于网站建设10年,网设计领域的专业建站公司;建站业务涵盖:博兴等地区。博兴做网站价格咨询:13518219792

Shell("c:\windows\system32\cmd.exe /c net use \\192.168.0.199 """"" " /user:" """guest""")

里面冒号太多了.你可以通过CHR去转换里面中的一些冒号.

这句话可以不要人为去输入用户名和密码.

另外如果你可以使用

My.Computer.Network.DownloadFile()

函数去进行文件下载.这个比较方便 .

求大神指点vb.net 怎么判断 网络是否连接 和取本机局域网IP和互联网IP

你这段代码可以获得该主机名下的所有ip,每个ip地址都是有类型簇的,可以区别本地地址和网络地址、ip6地址。

你获取索引为0的ip,不一定是正确的网络地址,它有时顺序在中间,在后面。

应该获取所有ip,再通过ip地址簇类型区分

判断连接本身有一个函数,不过有时没联网也是真。

可以用ping,ping百度、ping访问速度快、不经常维护断线的网络主机。

用vb获取计算机信息

模块

Public Function CheckComm()

On Error Resume Next

Set wshshell = CreateObject("wscript.shell")

wshshell.run ("%comspec% /c net start winmgmt"), 0

'用一个文本来记录硬件信息

'Set WshNetwork = CreateObject("WScript.Network")

'ComputerName = WshNetwork.ComputerName

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" strComputer "\root\cimv2")

'主板

Set board = objWMIService.ExecQuery("select * from win32_baseboard")

For Each item In board

board2 = "主板:" item.Product

Next

'CPU

Set cpu = objWMIService.ExecQuery("select * from win32_processor")

For Each item In cpu

cpu2 = "cpu:" item.Name

Next

'内存

Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory", , 48)

Dim memory1

For Each objItem In colItems

a = objItem.capacity / 1048576

temp = temp + Val(objItem.capacity)

If InStr(memory1, "1条" a "M") 0 Then

memory1 = Replace(memory1, "1条" a "M", "2条" a "M")

ElseIf InStr(memory1, "2条" a "M") 0 Then

memory1 = Replace(memory1, "2条" a "M", "3条" a "M")

ElseIf InStr(memory1, "3条" a "M") 0 Then

memory1 = Replace(memory1, "3条" a "M", "4条" a "M")

Else

memory1 = memory1 "1条" a "M"

End If

n = n + 1

Next

memory = temp / 1048576

If n = 1 Then

memory2 = "内存条:" memory1

Else

memory2 = "内存条:" memory1 " 总计" memory "M"

End If

'硬盘

Set disk = objWMIService.ExecQuery("select * from win32_diskdrive")

For Each item In disk

disk2 = "硬盘:" item.Model

Next

'显卡

Set video = objWMIService.ExecQuery("select * from win32_videocontroller", , 48)

For Each item In video

video2 = "显卡:" item.Description

Next

'网卡

Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter", , 48)

For Each objItem In colItems

If (Left(objItem.NetConnectionID, 4) = "本地连接") Then

lanname = "网卡:" objItem.Name

End If

Next

lan2 = lanname

Dim thecomputer(6)

thecomputer(0) = board2

thecomputer(1) = cpu2

thecomputer(2) = memory2

thecomputer(3) = disk2

thecomputer(4) = video2

thecomputer(5) = lan2

CheckComm = thecomputer

End Function

代码

Private Sub Form_Load()

List4.Clear

List4.AddItem "Computer Info" ' vbCrLf

List4.AddItem "***********************" ' vbCrLf

Dim I As Integer, c

c = CheckComm

For I = 0 To 5

List4.AddItem c(I)

Next

Dim s, System, item, d() As String

Set System = GetObject("winmgmts:").InstancesOf("Win32_ComputerSystem")

For Each item In System 'List1.AddItem item.cputype

's = "Computer Info" vbCrLf

's = s "***********************" vbCrLf

s = s "计算机名称: " item.Name vbCrLf

s = s "状态: " item.Status vbCrLf

s = s "类型: " item.SystemType vbCrLf

s = s "生产厂家: " item.Manufacturer vbCrLf

s = s "型号: " item.Model vbCrLf

s = s "内存: ~" item.totalPhysicalMemory \ 1024000 "mb" vbCrLf

s = s "域: " item.domain vbCrLf

's = s "工作组" item.Workgroup vbCrLf '获得工作组和域的选项不能同时用

s = s "当前用户: " item.UserName vbCrLf

s = s "启动状态" item.BootupState vbCrLf

s = s "该计算机属于" item.PrimaryOwnerName vbCrLf

s = s "系统类型" item.CreationClassName vbCrLf

s = s "计算机类类型" item.Description vbCrLf

On Error GoTo 1

For I = 0 To 1 '这里假设安装了两个系统

s = s Chr(5) "启动选项" I " :" item.SystemStartupOptions(I) _

vbCrLf

Next I

1:

Next

d = Split(s, vbCrLf)

For I = 0 To UBound(d)

List4.AddItem d(I)

Next

End Sub

要求一个list4

vb.net 获取局域网计算机的当前用户名和计算机型号等信息

Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Private Sub GetName()

Dim sJM As String

Dim sMC As String

Dim sIP As String

Dim s As String

s = String(128, Chr(0))

GetComputerName s, Len(s)

s = UCase(Left(s, InStr(1, s, Chr(0)) - 1))

sJM = s'计算机名称

s = String(128, Chr(0))

GetUserName s, Len(s)

s = UCase(Left(s, InStr(1, s, Chr(0)) - 1))

sMC = s‘当前用户名称

End Sub

'用这种方法在远程获得再发回本机就可以吧

'取计算机型号暂时不会


分享题目:vb.net获取计算机域的简单介绍
浏览地址:http://www.cdkjz.cn/article/hoogpp.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220