giriprasasd100
15 years agoOccasional Contributor
Conflict in TestComplete and Windows Host script results
Hi All,
I am running a small WMI script in TestComplete 7.20.562.7 version on Windows Server 2008 machine with service pack 1.
The script will list all the installed programs along with total count.
While trying to run in TestComplete and as simple VBScript file in WindowsHost with necessary modifications(Log.Message in TestComplete and WScript.Write in Windows Script Host), the output is not same in both the cases...
The TestComplete version's output is getting conflict with Windows Script Host version output. Also my indented installed software is missing in TestComplete output.
Also while running the same scripts in Windows XP and Windows Server 2003 machines, both the results are perfectly matching !!!
Please find the script used...
VBScript
==================================
Set objNetwork = Wscript.CreateObject("Wscript.Network")
Set objStdOut = WScript.StdOut
Dim count : count = 0
strHost = "."
Const HKLM = &H80000002
Set objReg = GetObject("winmgmts://" & strHost & "/root/default:StdRegProv")
Const strBaseKey = "Software\Microsoft\Windows\CurrentVersion\Uninstall\"
objReg.EnumKey HKLM, strBaseKey, arrSubKeys
For Each strSubKey In arrSubKeys
intRet = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, _
"DisplayName", strValue)
If intRet <> 0 Then
intRet = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, _
"QuietDisplayName", strValue)
End If
If (strValue <> "") and (intRet = 0) Then
count = count + 1
End If
Next
objStdOut.Write "Count: " & count
objStdOut.Close
----------------------------------------------------------------
TestComplete script
===========================================
Sub list
Dim count : count = 0
strHost = "."
Const HKLM = &H80000002
Set objReg = GetObject("winmgmts://" & strHost & "/root/default:StdRegProv")
Const strBaseKey = "Software\Microsoft\Windows\CurrentVersion\Uninstall\"
objReg.EnumKey HKLM, strBaseKey, arrSubKeys
For Each strSubKey In arrSubKeys
intRet = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, _
"DisplayName", strValue)
If intRet <> 0 Then
intRet = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, _
"QuietDisplayName", strValue)
End If
If (strValue <> "") and (intRet = 0) Then
Log.Message(strValue)
count = count + 1
End If
Next
Log.Message("Total Count:" & count)
End Sub
-----------------------------------------------------------------------
Is this a known issue or it depends up on OS ?
Please help in solving this issue.
Thanks in advance
Regards,
Giri Prasad
I am running a small WMI script in TestComplete 7.20.562.7 version on Windows Server 2008 machine with service pack 1.
The script will list all the installed programs along with total count.
While trying to run in TestComplete and as simple VBScript file in WindowsHost with necessary modifications(Log.Message in TestComplete and WScript.Write in Windows Script Host), the output is not same in both the cases...
The TestComplete version's output is getting conflict with Windows Script Host version output. Also my indented installed software is missing in TestComplete output.
Also while running the same scripts in Windows XP and Windows Server 2003 machines, both the results are perfectly matching !!!
Please find the script used...
VBScript
==================================
Set objNetwork = Wscript.CreateObject("Wscript.Network")
Set objStdOut = WScript.StdOut
Dim count : count = 0
strHost = "."
Const HKLM = &H80000002
Set objReg = GetObject("winmgmts://" & strHost & "/root/default:StdRegProv")
Const strBaseKey = "Software\Microsoft\Windows\CurrentVersion\Uninstall\"
objReg.EnumKey HKLM, strBaseKey, arrSubKeys
For Each strSubKey In arrSubKeys
intRet = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, _
"DisplayName", strValue)
If intRet <> 0 Then
intRet = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, _
"QuietDisplayName", strValue)
End If
If (strValue <> "") and (intRet = 0) Then
count = count + 1
End If
Next
objStdOut.Write "Count: " & count
objStdOut.Close
----------------------------------------------------------------
TestComplete script
===========================================
Sub list
Dim count : count = 0
strHost = "."
Const HKLM = &H80000002
Set objReg = GetObject("winmgmts://" & strHost & "/root/default:StdRegProv")
Const strBaseKey = "Software\Microsoft\Windows\CurrentVersion\Uninstall\"
objReg.EnumKey HKLM, strBaseKey, arrSubKeys
For Each strSubKey In arrSubKeys
intRet = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, _
"DisplayName", strValue)
If intRet <> 0 Then
intRet = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, _
"QuietDisplayName", strValue)
End If
If (strValue <> "") and (intRet = 0) Then
Log.Message(strValue)
count = count + 1
End If
Next
Log.Message("Total Count:" & count)
End Sub
-----------------------------------------------------------------------
Is this a known issue or it depends up on OS ?
Please help in solving this issue.
Thanks in advance
Regards,
Giri Prasad