⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmremotecommand.frm

📁 全面网络扫描器VB源代码 很实用
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmremotecommand 
   BackColor       =   &H00000000&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Remote Command"
   ClientHeight    =   3045
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6345
   Icon            =   "frmremotecommand.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3045
   ScaleWidth      =   6345
   Begin VB.TextBox Text3 
      Enabled         =   0   'False
      Height          =   285
      Left            =   3720
      Locked          =   -1  'True
      TabIndex        =   10
      Top             =   120
      Width           =   2055
   End
   Begin VB.TextBox Text2 
      Height          =   285
      Left            =   83
      TabIndex        =   7
      Top             =   240
      Width           =   2775
   End
   Begin VB.CommandButton Command5 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Do It"
      Height          =   255
      Left            =   3683
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   1200
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Left            =   83
      TabIndex        =   4
      Text            =   "NC -l -v -p 2002"
      Top             =   840
      Width           =   4815
   End
   Begin VB.CommandButton Command4 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Close"
      Height          =   375
      Left            =   5040
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   2520
      Width           =   1215
   End
   Begin VB.CommandButton Command3 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Remote Restart"
      Height          =   255
      Left            =   83
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   2640
      Width           =   1695
   End
   Begin VB.CommandButton Command2 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Remote Shut Down"
      Height          =   255
      Left            =   83
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   2280
      Width           =   1695
   End
   Begin VB.Label Label4 
      Alignment       =   2  'Center
      BackColor       =   &H00FFFFFF&
      Caption         =   "Extra:"
      Height          =   255
      Left            =   90
      TabIndex        =   9
      Top             =   1920
      Width           =   1695
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      BackColor       =   &H00FFFFFF&
      Caption         =   "NOTE:  You must have the RemoteShutdown privilege to successfully invoke the Reboot or Shut Down method."
      Height          =   855
      Left            =   1883
      TabIndex        =   8
      Top             =   2040
      Width           =   2895
   End
   Begin VB.Label Label2 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Please type the computer name:"
      Height          =   255
      Left            =   83
      TabIndex        =   6
      Top             =   0
      Width           =   2775
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Command to run on remote computer:"
      Height          =   255
      Left            =   83
      TabIndex        =   3
      Top             =   600
      Width           =   2775
   End
End
Attribute VB_Name = "frmremotecommand"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command2_Click()
On Error Resume Next
'MDIFrmmain.StatusBar1.Panels(1).Text = "Status: Working..."
Dim ComputerName As String
ComputerName = Text2.Text
Set OpSysSet = GetObject("winmgmts:{(Debug,RemoteShutdown)}//" & ComputerName & "/root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")

For Each OpSys In OpSysSet
    Call OpSys.Shutdown
Next
'MDIFrmmain.StatusBar1.Panels(1).Text = "Status:"
End Sub

Private Sub Command3_Click()
On Error Resume Next
'MDIFrmmain.StatusBar1.Panels(1).Text = "Status: Working..."
Dim ComputerName As String
ComputerName = Text2.Text
Set OpSysSet = GetObject("winmgmts:{(RemoteShutdown)}//" & ComputerName & "/root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")

For Each OpSys In OpSysSet
    Call OpSys.Reboot
Next
'MDIFrmmain.StatusBar1.Panels(1).Text = "Status:"
End Sub

Private Sub Command4_Click()
Unload Me
End Sub

Private Sub Command5_Click()
On Error Resume Next
'MDIFrmmain.StatusBar1.Panels(1).Text = "Status: Working..."
Dim servername As String
Dim Command2 As String
Dim username2 As String
Dim password As String
username2 = txtAdminName
password = txtAdminPassw
Command2 = Text1.Text
servername = Text2.Text

'If frmdomainlogin.Check1.value = 1 Then
Set Process = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & servername & "\root\cimv2:Win32_Process")
'Else
'Set Process = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & servername & "\root\cimv2:Win32_Process")
'End If
result = Process.Create(Text1.Text, Null, Null, processid)

If err <> 0 Then
    Text3.Text = "Error: " & err.Description & " 0x" & Hex(err.Number)
    Else
    Text3.Text = "Successful"
End If
'MDIFrmmain.StatusBar1.Panels(1).Text = "Status:"
End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
 Call Command5_Click
 DoEvents
 End If
End Sub

Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
 Call Command5_Click
 DoEvents
 End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -