From: Tcs on
I only want the setup.exe to run if the version of the LDISCN32.EXE
file <> "8.70.8.22". On the machine on which I have been testing
this, I KNOW the version IS "8.70.8.22". So...it should NOT run. But
EVERY time I try to run this...it executes the setup.exe.

What am I doing wrong? Am I not checking the version correctly?
Or...???

Thanks in advance,

Tom

-----

' Checks the version of ldiscn32.exe and cranks up sp6 install if the
rev is <> sp6

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_Datafile Where name = 'C:\\Program
Files\\LANDesk\\LDClient\\LDISCN32.EXE'")

For Each objFile in colFiles
If objFile.Version <> "8.70.8.22" Then

WScript.Echo _
"Made it to the execution partion..."

strCmd = "%comspec% /c csccmd
\\LDSVR001\LANDesk\LD87-SP6-Client\setup.exe -S"

Set objShell = CreateObject("Wscript.Shell")
intReturn = objShell.Run(strCmd, 2, True)
Wscript.Echo "Return code: " & CStr(intReturn)

End If
Next
From: urkec on
"Tcs" wrote:

> I only want the setup.exe to run if the version of the LDISCN32.EXE
> file <> "8.70.8.22". On the machine on which I have been testing
> this, I KNOW the version IS "8.70.8.22". So...it should NOT run. But
> EVERY time I try to run this...it executes the setup.exe.
>
> What am I doing wrong? Am I not checking the version correctly?
> Or...???
>
> Thanks in advance,
>
> Tom
>
> -----
>
> ' Checks the version of ldiscn32.exe and cranks up sp6 install if the
> rev is <> sp6
>
> strComputer = "."
>
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" & strComputer &
> "\root\cimv2")
> Set colFiles = objWMIService.ExecQuery _
> ("Select * from CIM_Datafile Where name = 'C:\\Program
> Files\\LANDesk\\LDClient\\LDISCN32.EXE'")
>
> For Each objFile in colFiles
> If objFile.Version <> "8.70.8.22" Then
>
> WScript.Echo _
> "Made it to the execution partion..."
>
> strCmd = "%comspec% /c csccmd
> \\LDSVR001\LANDesk\LD87-SP6-Client\setup.exe -S"
>
> Set objShell = CreateObject("Wscript.Shell")
> intReturn = objShell.Run(strCmd, 2, True)
> Wscript.Echo "Return code: " & CStr(intReturn)
>
> End If
> Next
>



It is possible that objFile.Version doesn't contain what you expect. Try to
check it before the comparison:


strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")

Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_Datafile " & _
"Where name = 'C:\\Program Files\\LANDesk\\LDClient\\LDISCN32.EXE'")

For Each objFile in colFiles

WScript.Echo objFile.Version

If objFile.Version <> "8.70.8.22" Then
WScript.Echo "Made it to the execution partion..."
End If

Next



--
urkec



From: urkec on
"Tcs" wrote:

> I only want the setup.exe to run if the version of the LDISCN32.EXE
> file <> "8.70.8.22". On the machine on which I have been testing
> this, I KNOW the version IS "8.70.8.22". So...it should NOT run. But
> EVERY time I try to run this...it executes the setup.exe.
>
> What am I doing wrong? Am I not checking the version correctly?
> Or...???
>
> Thanks in advance,
>
> Tom
>
> -----
>
> ' Checks the version of ldiscn32.exe and cranks up sp6 install if the
> rev is <> sp6
>
> strComputer = "."
>
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" & strComputer &
> "\root\cimv2")
> Set colFiles = objWMIService.ExecQuery _
> ("Select * from CIM_Datafile Where name = 'C:\\Program
> Files\\LANDesk\\LDClient\\LDISCN32.EXE'")
>
> For Each objFile in colFiles
> If objFile.Version <> "8.70.8.22" Then
>
> WScript.Echo _
> "Made it to the execution partion..."
>
> strCmd = "%comspec% /c csccmd
> \\LDSVR001\LANDesk\LD87-SP6-Client\setup.exe -S"
>
> Set objShell = CreateObject("Wscript.Shell")
> intReturn = objShell.Run(strCmd, 2, True)
> Wscript.Echo "Return code: " & CStr(intReturn)
>
> End If
> Next
>



It is possible that objFile.Version doesn't contain what you expect. Try to
check it before the comparison:


strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")

Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_Datafile " & _
"Where name = 'C:\\Program Files\\LANDesk\\LDClient\\LDISCN32.EXE'")

For Each objFile in colFiles

WScript.Echo objFile.Version

If objFile.Version <> "8.70.8.22" Then
WScript.Echo "Made it to the execution partion..."
End If

Next


--
urkec


From: Al Dunbar on

"Tcs" <someone(a)somewhere.com> wrote in message
news:3ncso49q9v7h2e4j9ashuqgv6ikpp38pbt(a)4ax.com...
>I only want the setup.exe to run if the version of the LDISCN32.EXE
> file <> "8.70.8.22". On the machine on which I have been testing
> this, I KNOW the version IS "8.70.8.22". So...it should NOT run. But
> EVERY time I try to run this...it executes the setup.exe.
>
> What am I doing wrong? Am I not checking the version correctly?
> Or...???

I do not know for sure, but it could be that there is some difference in
data types that is causing this problem. I'd suggest that you see what the
typename and vartype functions have to say about objFile.Version and
"8.70.8.22", to see if they are the same. If not, then I'd convert one or
both to the same type. It might just be, for example, that .Version returns
an array.

/Al

> Thanks in advance,
>
> Tom
>
> -----
>
> ' Checks the version of ldiscn32.exe and cranks up sp6 install if the
> rev is <> sp6
>
> strComputer = "."
>
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" & strComputer &
> "\root\cimv2")
> Set colFiles = objWMIService.ExecQuery _
> ("Select * from CIM_Datafile Where name = 'C:\\Program
> Files\\LANDesk\\LDClient\\LDISCN32.EXE'")
>
> For Each objFile in colFiles
> If objFile.Version <> "8.70.8.22" Then
>
> WScript.Echo _
> "Made it to the execution partion..."
>
> strCmd = "%comspec% /c csccmd
> \\LDSVR001\LANDesk\LD87-SP6-Client\setup.exe -S"
>
> Set objShell = CreateObject("Wscript.Shell")
> intReturn = objShell.Run(strCmd, 2, True)
> Wscript.Echo "Return code: " & CStr(intReturn)
>
> End If
> Next


From: ekkehard.horner on
Tcs schrieb:
> I only want the setup.exe to run if the version of the LDISCN32.EXE
> file <> "8.70.8.22". On the machine on which I have been testing
> this, I KNOW the version IS "8.70.8.22". So...it should NOT run. But
> EVERY time I try to run this...it executes the setup.exe.
[...]
To merge urkec's and Al Dunbar's advice:
> For Each objFile in colFiles

WScript.Echo objFile.Name _
, objFile.Version _
, ">" & objFile.Version & "<" _
, TypeName( objFile.Version )

> If objFile.Version <> "8.70.8.22" Then
[...]

For me, TypeName( objFile.Version ) returns: "String"