我需要将VBscript转换为VB

我需要将VBscript转换为VB

本文介绍了我需要将VBscript转换为VB.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个vbscript代码,可以告诉您何时以及谁登录到远程PC。通常在VB6中我可以将其粘贴进去,只需更改输入和输出即可。我是VB.Net的新手,我尝试搜索类似的代码,但我发现
我无法使用。有人可以将此脚本转换为示例代码。


strComputer = InputBox("请输入计算机名称以检查当前登录的用户活动:")


设置objWMIService = GetObject(& ; winmgmts:\\"& strComputer&" \root\cimv2")


设置colItems = objWMIService.ExecQuery(" select * from win32_ComputerSystem", ,48)对于ColItems中的每个对象


  MsgBox" Logged on user:" &安培; StrComputer& " ;.结果:  " &安培; objItem.username


下一步




解决方案

I have this vbscript code that tells you when if and who is logged into a remote PC. Usually in VB6 I could just paste it in and it would work just changing the input and outputs. I'm pretty new to VB.Net and I did try searching for similar code but I found nothing I could use. Can someone convert this script to a sample code.

strComputer = InputBox("Please enter computer name to check for currently logged in user activity:")

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

Set colItems = objWMIService.ExecQuery("Select * from win32_ComputerSystem",,48)For Each objItem in ColItems

 MsgBox "Logged on user: " & StrComputer & ". Result:  " & objItem.username

Next


解决方案


这篇关于我需要将VBscript转换为VB.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 20:59