我是vb.net的初学者。我有两台笔记本电脑使用交叉电缆连接。一台笔记本电脑是服务器,另一台是客户端。我想要发生的是使用服务器电脑关闭客户端电脑。这是我的起始代码,请帮忙:D
Public Class frmShutdown
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
If MsgBox("Are you sure you want to cancel?", MsgBoxStyle.YesNoCancel, "Cancel shutdown") = MsgBoxResult.Yes Then
frmServer.Show()
Me.Hide()
End If
End Sub
Private Sub frmShutdown_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Top = (Screen.PrimaryScreen.WorkingArea.Height - Me.Height) / 2
Me.Left = (Screen.PrimaryScreen.WorkingArea.Width - Me.Width) / 2
End Sub
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub btnShutdown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShutdown.Click
End Sub
结束班
答案 0 :(得分:1)
试试这个:
Private Sub btnShutdown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShutdown.Click
System.Diagnostics.Process.Start("ShutDown", "-r -f -m \\YourClientPCName -t 30 ")
End Sub
点击此链接:http://technet.microsoft.com/en-us/library/bb491003.aspx
答案 1 :(得分:0)
如果您拥有安全权限,则可以执行传递相关参数的shutdown
命令 - 尤其是/m \\<computer name>
参数。