Archive

Archive for the ‘Visual Basic’ Category

Script to fix error with start up of AU and BITS (EventID 7023 and 7024)

June 30th, 2009 Zaur Bahramov No comments

This script detects and tries to fix the error related to start up of Automatic Updates and BITS services on network computers. Such error is related to security identifier (EventID 7023 and EventID 7024).  This problem is usually observed on network computers after applying changes to group policies. In such cases the script will reset a security identifier as per Microsoft KB 555336 (http://support.microsoft.com/kb/555336) and start Automatic Updates and BITS. Can be usefull for networks where Windows Server Update Services 3.0 (WSUS) is used.

Script is taken from: http://forum.vingrad.ru/forum/topic-154708/view-all.html

Read more…

Script for remote reboot/shutdown, power off and more.

June 30th, 2009 Zaur Bahramov No comments

Script for remote reboot/shutdown, power off, etc. You must have proper rights on a remote computer  for this script to work.

Read more…

Script to manage Event Log files

June 30th, 2009 Zaur Bahramov No comments

This script will check the size of the Event Log files and if any of these files will have the size greater than defined value it will back it up and then clean it.

Read more…

VB Script to query domain computers for currently logged in users

June 30th, 2009 Zaur Bahramov No comments
The script will query domain computers for logged on users on each computer

Open / Close CD ROM in Visual Basic

March 23rd, 2009 Zaur Bahramov No comments

This code demonstrates how to create CD ROM open and close calls. Create a Windows Forms Application and add two buttons. I will leave default names in this example Form1 for the form and Button1 and Button2 for buttons. I’ve changed the text property only.

form1

Read more…

Categories: Visual Basic Tags: ,

How to Log Off, Restart and Shutdown PC in Visual Basic

March 23rd, 2009 Zaur Bahramov No comments

Here’s a small example of how to log off, restart and shutdown computer in Visual Basic. Open Visual Studio and create a new Windows Forms Application:

01

In the Solution Explorer right-click on ExitWindows –> Add –> Module… Leave the default name Module1.vb as is and click Add.

Paste the following code in Module1:

Public Declare Function ExitWindows Lib "user32" (ByVal uFlags As Long, _
ByVal dwReserved As Long) As Long

Public Const EWX_LOGOFF = 0
Public Const EWX_SHUTDOWN = 1
Public Const EWX_REBOOT = 2
Public Const EWX_FORCE = 4

Read more…

Categories: Visual Basic Tags: ,

Creating a custom DLL in Visual Basic .NET

March 18th, 2009 Zaur Bahramov No comments

One of the best programming practices is to use DLL (Dynamic Link Library) files to re-use your code and controls across your applications. In this tutorial I will show you how to create a sample DLL file in Visual Basic .NET Professional edition and attach it to a new application.

1)    Create a new project, select Windows Forms Control Library and name it MiniCalc

Read more…

Categories: Visual Basic Tags: , ,