某些三星Android手机有一个错误,如果插入USB,USB调试会自动打开.这显然是一个安全问题.我想编写一个程序来禁用USB调试,这样我就可以在插入usb-plug时启动它.关于如何做到这一点的任何想法?
我需要在窗口(explorer.exe)中使用不同的凭据在远程服务器上打开一个文件夹.
我设法没有凭据(我的凭据),但当我使用另一个用户名和另一个密码而不是我的时,它会打开提示输入用户名和密码,并显示"访问被拒绝".
在远程桌面上的访问日志中,它表示我尝试使用自己的用户名连接,而不是我输入的其他用户名.所以,这个过程显然没有用.
但是,我无法弄清楚为什么.我的代码如下:
Dim domain, username, passwordStr, remoteServerName As String
Dim password As New Security.SecureString
Dim command As New Process
domain = "domain.com"
username = "username"
passwordStr = "password"
remoteServerName = "serverName"
For Each c As Char In passwordStr.ToCharArray
password.AppendChar(c)
Next
command.StartInfo.FileName = "explorer.exe"
command.StartInfo.Arguments = "\\" & serverName & "\admin$\Temp"
command.StartInfo.UserName = username
command.StartInfo.Password = password
command.StartInfo.Domain = domain
command.StartInfo.Verb = "open"
command.StartInfo.UseShellExecute = False
command.Start()
Run Code Online (Sandbox Code Playgroud) 在 VB.Net 中,我尝试使用不同的凭据(用户没有管理员权限)连接到本地计算机上的 WMI,但出现此异常:
« 用户凭据不能用于本地连接 »
这是代码:
Dim path As ManagementPath = Nothing
Dim options As ConnectionOptions = Nothing
Dim scope As ManagementScope = Nothing
path = New ManagementPath("\\" & vServerName & "\root\CIMV2")
options = New ConnectionOptions
options.Username = vUsername
options.Password = vPassword
Scope = New ManagementScope(path, options)
Scope.Connect()
Run Code Online (Sandbox Code Playgroud)