Got this VB script which runs outside Installshield X, but not inside in the Custom Action. The error is(translated to english):
A problem has occurred. A script, needed for this installation, could not be run. Contact supportperson or dealer.
My script waits for a process to stop, and then continues the installation. It seems that the error comes when the WScript is called. It works allright in a .vbs file. Any good suggestions from you good people ?

Function Running()
Set WshShell = WScript.CreateObject("WScript.Shell")
Set locator = CreateObject("WbemScripting.SWbemLocator")
Set service = locator.ConnectServer()
ISProcessId = Session.Property("PROCESSID")
Set props = service.ExecQuery("select ProcessId, description from Win32_Process where ProcessId = " & ISProcessId)
num = props.Count
If num > 0 Then
Running = true
Else
Running = false
End If
Set WSHShell = Nothing
End Function
While Running()
Wscript.sleep 1000
Wend