45 pts.
45 pts.
  Help
 Approved Answer - Chosen by Ssergio25 (Question Asker)

OK the actual code:

‘STEP 1 WMI Call
‘*************************************************
strComputer = “.”
Set objWMIService = GetObject(”winmgmts:\” & strComputer & “rootCIMV2″)
Set colItems = objWMIService.ExecQuery( _
“SELECT * FROM Win32_OperatingSystem”,,48)
For Each objItem in colItems
OS = objItem.Version
Next

OS_Installed = Left(CStr(OS),3)…………….’THIS LINE IS THE ONE THAT SOLVED MY ISSUE, i HAD TO CONVERT “OS” TO A STRING IN ORDER TO USE THE LEFT FUNCTION

‘STEP 2 OS found is XP
‘***************************************************

If OS_Installed = “6.1″ Then
WritetoLog “OS is Windows 7 Version Number ” & OS_Installed
‘CONTINUE HERE WITH YOUR OWN LOGIC
End If

‘STEP 3 OS found is WINDOWS 7
‘***************************************************

If OS_Installed = “5.1″ Then
WritetoLog “OS is Windows XP Version Number ” & OS_Installed
‘CONTINUE HERE WITH YOUR OWN LOGIC
End If
ANSWERED:  Jul 8, 2011  5:57 PM (GMT)  by Ssergio25   45 pts.

 
Other Answers:
OK the actual code:

‘STEP 1 WMI Call
‘*************************************************
strComputer = “.”
Set objWMIService = GetObject(”winmgmts:\” & strComputer & “rootCIMV2″)
Set colItems = objWMIService.ExecQuery( _
“SELECT * FROM Win32_OperatingSystem”,,48)
For Each objItem in colItems
OS = objItem.Version
Next

OS_Installed = Left(CStr(OS),3)…………….’THIS LINE IS THE ONE THAT SOLVED MY ISSUE, i HAD TO CONVERT “OS” TO A STRING IN ORDER TO USE THE LEFT FUNCTION

‘STEP 2 OS found is XP
‘***************************************************

If OS_Installed = “6.1″ Then
WritetoLog “OS is Windows 7 Version Number ” & OS_Installed
‘CONTINUE HERE WITH YOUR OWN LOGIC
End If

‘STEP 3 OS found is WINDOWS 7
‘***************************************************

If OS_Installed = “5.1″ Then
WritetoLog “OS is Windows XP Version Number ” & OS_Installed
‘CONTINUE HERE WITH YOUR OWN LOGIC
End If
Last Wiki Answer Submitted:  Jul 8, 2011  5:57 PM (GMT)  by  Ssergio25   45 pts.
To see other answers submitted to the Answer Wiki View Answer History.
Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _




 

1.5.600 is a string.

Can you post your code ? Are you getting errors ?

Also, are you going to do this to other values ? if so, are the dots in fixed positions ?

Please provide more details.

 60,255 pts.

 

I too would like to see some of your code thus far, I think I know how to help you but would like to see what you’re doing so far.

 1,755 pts.

 

Sergio, pseudocode will not help trying to find the error. Why don’t you post your actual code ?

If your code is giving errors, in order to help you we need to know:
-Your code
-The exact error messages your are getting.

 60,255 pts.

 

Since we don’t have enough information, this is only a guess:

The value coming from the WMI call is probably not a string, but some type of object.

 60,255 pts.

 

OK the actual code:

‘STEP 1 WMI Call
‘*************************************************
strComputer = “.”
Set objWMIService = GetObject(”winmgmts:\” & strComputer & “rootCIMV2″)
Set colItems = objWMIService.ExecQuery( _
“SELECT * FROM Win32_OperatingSystem”,,48)
For Each objItem in colItems
OS = objItem.Version
Next

OS_Installed = Left(CStr(OS),3)…………….’THIS LINE IS THE ONE THAT SOLVED MY ISSUE, i HAD TO CONVERT “OS” TO A STRING IN ORDER TO USE THE LEFT FUNCTION

‘STEP 2 OS found is XP
‘***************************************************

If OS_Installed = “6.1″ Then
WritetoLog “OS is Windows 7 Version Number ” & OS_Installed
‘CONTINUE HERE WITH YOUR OWN LOGIC
End If

‘STEP 3 OS found is WINDOWS 7
‘***************************************************

If OS_Installed = “5.1″ Then
WritetoLog “OS is Windows XP Version Number ” & OS_Installed
‘CONTINUE HERE WITH YOUR OWN LOGIC
End If

 45 pts.

 

It seems that you have solved the issue.

Thanks for sharing your solution.

 60,255 pts.