473,545 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to check computername exists, before logon remotely

vb.net 2003

i wrote a windows service that does threading. My codes are

a) the service thread will read a list of machine from a text file
(machines.txt).
b) it then logon using the below
Dim returnValue As Boolean = LogonUser(m_nti d, m_domain, m_pwd,
LOGON32_LOGON_I NTERACTIVE, LOGON32_PROVIDE R_DEFAULT, tokenHandle)

if returnvalue = true

do part (c)

else

write a event log that computers do not exists

end if

c) once logon successful, it will do a wmi search for hotfix

Dim searchstring As String = "SELECT * FROM Win32_QuickFixE ngineering WHERE
HotFixID = " & "'" & m_kbhotfix & "'"

Dim searcher As New ManagementObjec tSearcher("\\" + computer +
"\root\CIMV 2", searchstring)

if hotfix is found, then write an event log to my pc that runs the services.

It works fine for the following scenarios

1) the logon id is a administrator of remote machines

I deliberately setup some bogus machines in my machines.txt. By right these
machines do not exists. However the returnvalue always go to "true", which
mean "false" machines the thread ignore and do not write any event log. How
can i check machine exists first or can the code generate some try/catch
that machines do not exist or i do not have permission ? all i want is that
returnvalue = false so that my eventlogs can write something ?




Jan 9 '06 #1
1 2812
Hi,

List Computers in network with api
http://www.vb-tips.com/default.aspx?...8-dad5ea63a743

List computers in network with active directory classes
http://www.vb-tips.com/default.aspx?...3-9c76953e41cf

Ken
----------------
"James" <jk****@hotmail .com> wrote in message
news:eQ******** *****@tk2msftng p13.phx.gbl...
vb.net 2003

i wrote a windows service that does threading. My codes are

a) the service thread will read a list of machine from a text file
(machines.txt).
b) it then logon using the below
Dim returnValue As Boolean = LogonUser(m_nti d, m_domain, m_pwd,
LOGON32_LOGON_I NTERACTIVE, LOGON32_PROVIDE R_DEFAULT, tokenHandle)

if returnvalue = true

do part (c)

else

write a event log that computers do not exists

end if

c) once logon successful, it will do a wmi search for hotfix

Dim searchstring As String = "SELECT * FROM Win32_QuickFixE ngineering
WHERE HotFixID = " & "'" & m_kbhotfix & "'"

Dim searcher As New ManagementObjec tSearcher("\\" + computer +
"\root\CIMV 2", searchstring)

if hotfix is found, then write an event log to my pc that runs the
services.

It works fine for the following scenarios

1) the logon id is a administrator of remote machines

I deliberately setup some bogus machines in my machines.txt. By right
these machines do not exists. However the returnvalue always go to "true",
which mean "false" machines the thread ignore and do not write any event
log. How can i check machine exists first or can the code generate some
try/catch that machines do not exist or i do not have permission ? all i
want is that returnvalue = false so that my eventlogs can write something
?




Jan 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2946
by: Mindy Geac | last post by:
Hello, i'm new with ASP! How can I display the hosting computername on the website, We have 2 servers and I want to know which server I'm getting the asp pages from. thnx, Mindy
7
2915
by: jrefactors | last post by:
I want to ask how password is stored and how to check the authentication? I have heard password is never encrypted and decrypted, but it is hashed. For example, consider a simple email logon authentication in a hash table: Key: my email address Value: hash_function(my plan text password)
6
10855
by: pw | last post by:
Hi, I need to check if a particular .jpg (complete with the path name) exists. How would I do that? Thanks,
14
3360
by: John J. Hughes II | last post by:
I have "Computer A" which is running Win2K3 and MS SQL server. And "Computer B" which is running a service that I have created. If I change the service on "Computer B" to run as a user my program is able to connect to the SQL server on "Computer A" correctly. But if I set the service on "Computer B" to run as a local system then I get an...
2
5916
by: Chris Podmore | last post by:
I don't know if this is the correct newsgroup but I couldn't find one for Windows Services Is it possible to check that a Windows Service is still running from another machine The idea being a couple of machines will be running my Windows Services to handle certain parts of our application, these machines will be located in the server room....
2
9065
by: Adnan Al-Ghourabi | last post by:
Hi, We have an application running on IIS 6.0, on a windows 2003 box. The back-end database, a SQL Server 2000, runs on anohter server, windows 2000. We have enabled integrated authentication, and provided the windows account the appropriate permissions in SQL Server. If running the application locally on the server, the user...
3
6234
by: Nick nkw | last post by:
I already following the steps in: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskaccessingsqlserverusingwindowsintegratedsecurity.asp But I still get the error. I found it works when using VS.Net internal web server. It use Domain\MachineName$ to connect SQL Server after publish to IIS. (It works on IIS...
4
10183
by: Simon Gare | last post by:
Hi all, below is an insert statement on an asp page that stores the date and time that a driver logged on, what I need is to check that they are now already logged on fields are SQL Server 2000 ID int DRIVER_NO int
1
3956
by: cactuscrust | last post by:
I'm running IIS6 Windows2003, and as you'll see very quickly.. I'm pretty new to this stuff. Lately I've been getting bombarded with login attempts.... sometimes several in the same second, and it can last for hours. The event viewer shows the following information for the failed login: Logon Failure: Reason: Unknown user name...
0
7465
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7416
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7752
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5969
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5325
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3449
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.