获取用户名、计算机名和域名

2015-11-13 0 746
获取用户名、计算机名和域名
Option Explicit
Dim objNet
On Error Resume Next 

'In case we fail to create object then display our custom error

Set objNet = CreateObject("WScript.NetWork") 
If  Err.Number <> 0 Then                'If error occured then display notice
	MsgBox "Don't be Shy." & vbCRLF &_
               "Do not press ""No"" If your browser warns you."
	Document.Location = "UserInfo.html"	  
                                        'Place the Name of the document. 
	                                'It will display again
End if
	
Dim strInfo
strInfo = "User Name is     " & objNet.UserName & vbCRLF & _
          "Computer Name is " & objNet.ComputerName & vbCRLF & _
          "Domain Name is   " & objNet.UserDomain
MsgBox strInfo
	
Set objNet = Nothing                    'Destroy the Object to free the Memory

遇见资源网 ASP/Basic 获取用户名、计算机名和域名 http://www.ox520.com/13562.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务