Click here to Skip to main content
15,888,984 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Read incoming number from Mobile Device and Save to Database Pin
Colin Angus Mackay7-Aug-07 9:21
Colin Angus Mackay7-Aug-07 9:21 
GeneralRe: Read incoming number from Mobile Device and Save to Database Pin
Dave Kreskowiak7-Aug-07 12:15
mveDave Kreskowiak7-Aug-07 12:15 
AnswerRe: Read incoming number from Mobile Device and Save to Database [modified] Pin
Kiran S. S.8-Aug-07 22:28
Kiran S. S.8-Aug-07 22:28 
QuestionStoring and Retrieving Images from SQL Server using - VB.Net Database Pin
M Irshad Qureshi6-Aug-07 17:56
M Irshad Qureshi6-Aug-07 17:56 
AnswerRe: Storing and Retrieving Images from SQL Server using - VB.Net Database Pin
Colin Angus Mackay6-Aug-07 23:47
Colin Angus Mackay6-Aug-07 23:47 
AnswerRe: Storing and Retrieving Images from SQL Server using - VB.Net Database Pin
ChandraRam7-Aug-07 0:17
ChandraRam7-Aug-07 0:17 
GeneralRe: Storing and Retrieving Images from SQL Server using - VB.Net Database Pin
Colin Angus Mackay7-Aug-07 0:34
Colin Angus Mackay7-Aug-07 0:34 
QuestionWin32_PingStatus Pin
jontyler6-Aug-07 17:09
jontyler6-Aug-07 17:09 
I am hoping to get some help with this one as I am stumped.

I am writing a custom program to change local administrator account settings on a batch of computers picked from AD. In my company, we have as many as 300 servers in any given OU, and with such a large number of servers, there is always flux in their status (building, operational, decommission, etc). In order to better handle the list of servers, I want to use the Win32_PingStatus to see the disposition of the server. I have been running this in a small test environment and have run into a snag. Here are the details:

Client machine: WinXP SP2
Domain: Windows 2003 Active Directory
Servers in question: HPPC (offline) & HUNTER (online)

When I first started running the Win32_PingStatus command, I noticed that it was returning code "0" (Success) for the HPPC server. I went to a command prompt and pinged the server to make sure there was nothing else going on and it came back with an error that it could not resolve the name. After tracing the code, I saw that it was missing all of the other StatusCode numbers and going to the Success routine.

To make matters more confusing, I opened WBEMTEST to run the same query (SELECT * FROM Win32_PingStatus WHERE address='HPPC') from the same machine where I am running this application. To my surprise, there is no listing for StatusCode in the return properties on the test query.

I have searched every possible combination on Google, but have yet to find anything that references this type of false positive on this query. I am hoping someone here has some insight into what might be going on (or what I am doing wrong) as this needs to be completed by Friday (8/10/2007).

Here is the code that I am using in the function:
<br />
Function IsAlive(ByVal mServerName As String) As String<br />
        Dim strStatus As String = ""<br />
        Dim myConnectionOptions As New ConnectionOptions<br />
        Dim myManagementScope As ManagementScope<br />
<br />
        With myConnectionOptions<br />
            .Impersonation = ImpersonationLevel.Impersonate<br />
            .Authentication = AuthenticationLevel.Unchanged<br />
        End With<br />
<br />
        myManagementScope = New ManagementScope("\\" & My.Computer.Name & "\root\cimv2", myConnectionOptions)<br />
        Try<br />
            myManagementScope.Connect()<br />
        Catch ex As Exception<br />
            Return "Connect Error - " & ex.Message<br />
        End Try<br />
<br />
        If myManagementScope.IsConnected = False Then<br />
            Return "Connect Error - Cannot connect"<br />
        End If<br />
<br />
        Dim myObjectSearcher As ManagementObjectSearcher<br />
        Dim myObjectCollection As ManagementObjectCollection<br />
        Dim myObject As ManagementObject<br />
<br />
        myObjectSearcher = New ManagementObjectSearcher(myManagementScope.Path.ToString, "SELECT * from Win32_PingStatus where Address = '" & mServerName & "'")<br />
        myObjectCollection = myObjectSearcher.Get()<br />
        For Each myObject In myObjectCollection<br />
            Select Case myObject.GetPropertyValue("StatusCode")<br />
                Case 11001<br />
                    strStatus = "Buffer Too Small"<br />
                Case 11002<br />
                    strStatus = "Destination Net Unreachable"<br />
                Case 11003<br />
                    strStatus = "Destination Host Unreachable"<br />
                Case 11004<br />
                    strStatus = "Destination Protocol Unreachable"<br />
                Case 11005<br />
                    strStatus = "Destination Port Unreachable"<br />
                Case 11006<br />
                    strStatus = "No Resources"<br />
                Case 11007<br />
                    strStatus = "Bad Option"<br />
                Case 11008<br />
                    strStatus = "Hardware Error"<br />
                Case 11009<br />
                    strStatus = "Packet Too Big"<br />
                Case 11010<br />
                    strStatus = "Request Timed Out"<br />
                Case 11011<br />
                    strStatus = "Bad Request"<br />
                Case 11012<br />
                    strStatus = "Bad Route"<br />
                Case 11013<br />
                    strStatus = "TimeToLive Expired Transit"<br />
                Case 11014<br />
                    strStatus = "TimeToLive Expired Reassembly"<br />
                Case 11015<br />
                    strStatus = "Parameter Problem"<br />
                Case 11016<br />
                    strStatus = "Source Quench"<br />
                Case 11017<br />
                    strStatus = "Option Too Big"<br />
                Case 11018<br />
                    strStatus = "Bad Destination"<br />
                Case 11032<br />
                    strStatus = "Negotiating IPSEC"<br />
                Case 0<br />
                    strStatus = "Success"<br />
            End Select<br />
        Next<br />
        Return strStatus<br />
    End Function<br />


In WBEMTEST, I am using the following query:

Select * FROM Win32_PingStatus WHERE address='HPPC'

And this is the response I get from that WBEMTEST query:

Win32_PingStatus.Address="HPPC".BufferSize=32.NoFragmentation=FALSE.RecordRoute=0.ResolveAddressNames=FALSE.SourceRoute="".SourceRouteType=0.Timeout=1000.TimestampRoute=0.TimeToLive=128.TypeofService=128

I appreciate any help that I can get on this.

One final note, I also tried these same tests on a valid machine name with the same results.

Thanks

Jonathan Tyler
AnswerRe: Win32_PingStatus [modified] Pin
Dave Kreskowiak7-Aug-07 11:56
mveDave Kreskowiak7-Aug-07 11:56 
GeneralRe: Win32_PingStatus Pin
jontyler7-Aug-07 12:27
jontyler7-Aug-07 12:27 
GeneralRe: Win32_PingStatus Pin
Dave Kreskowiak7-Aug-07 12:54
mveDave Kreskowiak7-Aug-07 12:54 
GeneralRe: Win32_PingStatus Pin
jontyler7-Aug-07 13:23
jontyler7-Aug-07 13:23 
GeneralRe: Win32_PingStatus Pin
Dave Kreskowiak7-Aug-07 13:40
mveDave Kreskowiak7-Aug-07 13:40 
QuestionUpgrading VB5 application to VB.Net or C# Pin
Ceriouss6-Aug-07 17:07
Ceriouss6-Aug-07 17:07 
AnswerRe: Upgrading VB5 application to VB.Net or C# Pin
Christian Graus6-Aug-07 17:33
protectorChristian Graus6-Aug-07 17:33 
AnswerRe: Upgrading VB5 application to VB.Net or C# Pin
Vasudevan Deepak Kumar7-Aug-07 1:52
Vasudevan Deepak Kumar7-Aug-07 1:52 
AnswerRe: Upgrading VB5 application to VB.Net or C# Pin
Kevin McFarlane7-Aug-07 2:01
Kevin McFarlane7-Aug-07 2:01 
AnswerRe: Upgrading VB5 application to VB.Net or C# Pin
leckey7-Aug-07 5:05
leckey7-Aug-07 5:05 
AnswerRe: Upgrading VB5 application to VB.Net or C# Pin
'Drew7-Aug-07 7:24
'Drew7-Aug-07 7:24 
GeneralRe: Upgrading VB5 application to VB.Net or C# Pin
Dave Kreskowiak7-Aug-07 11:49
mveDave Kreskowiak7-Aug-07 11:49 
AnswerRe: Upgrading VB5 application to VB.Net or C# Pin
'Drew7-Aug-07 12:14
'Drew7-Aug-07 12:14 
GeneralRe: Upgrading VB5 application to VB.Net or C# Pin
Dave Kreskowiak7-Aug-07 12:50
mveDave Kreskowiak7-Aug-07 12:50 
GeneralRe: Upgrading VB5 application to VB.Net or C# Pin
'Drew7-Aug-07 12:56
'Drew7-Aug-07 12:56 
GeneralRe: Upgrading VB5 application to VB.Net or C# Pin
emunews31-Oct-08 3:15
emunews31-Oct-08 3:15 
QuestionChanging the location of a form through code Pin
'Drew6-Aug-07 13:01
'Drew6-Aug-07 13:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.