473,327 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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_ntid, m_domain, m_pwd,
LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_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_QuickFixEngineering WHERE
HotFixID = " & "'" & m_kbhotfix & "'"

Dim searcher As New ManagementObjectSearcher("\\" + computer +
"\root\CIMV2", 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 2797
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*************@tk2msftngp13.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_ntid, m_domain, m_pwd,
LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_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_QuickFixEngineering
WHERE HotFixID = " & "'" & m_kbhotfix & "'"

Dim searcher As New ManagementObjectSearcher("\\" + computer +
"\root\CIMV2", 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
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
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...
6
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
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...
2
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...
2
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,...
3
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....
4
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...
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.