Skip to main content

Posts

How to Hide File using VB.Net

Private Sub HideFile(ByVal strFilePath As String) Try Dim strFInfo As New FileInfo(strFilePath) strFInfo.Attributes = FileAttributes.Hidden MessageBox.Show("Successfully Applied.") Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub

Create Service on Remote Machine

Private Sub CrateService(ByVal strComputer As String) Dim objWMIService, colServiceList, objService, errReturn, objSWbemLocator Const OWN_PROCESS = 16 Const NOT_INTERACTIVE = False Const NORMAL_ERROR_CONTROL = 2 Dim strName, strDisplay, strPath As String strName = txtName.Text strDisplay = txtDisplay.Text strPath = txtPath.Text Try objSWbemLocator = CreateObject("WbemScripting.SWbemLocator") If (strComputer = Environment.MachineName.ToString) Then objWMIService = objSWbemLocator.ConnectServer(strComputer, "root\cimv2") Else objWMIService = objSWbemLocator.ConnectServer(strComputer, "root\cimv2", strTargetUser, strTargetPwd) End If objWMIService.Security_.ImpersonationLevel = 3 objService = objWMIService.Get("Win32_BaseService") errReturn = objService.Cr...

Change IE Proxy on Remote Machine

Private Sub ChangeProxy(ByVal IP As String, ByVal Proxy As Boolean, ByVal strAddress As String, ByVal ByPass As Boolean) Dim strComputer Dim strUserName Dim strPassword Dim objLocator Dim objService Dim objRegistry Dim strKeyPath, strValueName, strValue As String Dim dwValue As Integer Const HKEY_CURRENT_USER = &H80000001 strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" strComputer = IP strUserName = UserName strPassword = Password Try objLocator = CreateObject("WbemScripting.SWbemLocator") If (IP = System.Environment.MachineName) Then objService = objLocator.ConnectServer(strComputer, "Root\Default") Else objService = objLocator.ConnectServer(strComputer, "Root\Default", strUserName, strPassword) End If ob...

Kill Process on Remote Machine

Private Sub ProcessKill(ByVal strIP As String, ByVal PID As Integer) Dim query As Management.ManagementObjectSearcher Dim queryCollection As Management.ManagementObjectCollection Dim management_object1 As Management.ManagementObject Dim msc As Management.ManagementScope Dim co As New Management.ConnectionOptions co.Username = UserName co.Password = Password If (strIP = Environment.MachineName.ToString) Then msc = New Management.ManagementScope("\\" & strIP & "\root\cimv2") Else msc = New Management.ManagementScope("\\" & strIP & "\root\cimv2", co) End If Dim id As String = PID Dim query_command As String = "SELECT * FROM Win32_Process where ProcessId=" & id Dim select_query As Management.SelectQuery = New Management.SelectQuery(query_command) Try query = New Manage...