Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with popup not appearing

Status
Not open for further replies.

Briandr

MIS
Jul 11, 2003
177
US
Hi,

I have a vbscript with a 'Do' section that should invoke a pop up timer. This works well on XP, but on W7 x64 I am not even getting the pop up. The code short of the MSI file being different for each respective platform is exactly the same. Any ideas?

Dim oShell, fso, prodir, strKeyPath
Dim path, i, dpath
Dim strComputer
Dim strDirectory, sScriptDir
Dim sTitle: sTitle = "My Title"
Dim sLogHeader : sLogHeader = sTitle & VbCrLf
'Wscript.Echo sTitle
strComputer = "."
set oShell= CreateObject("Wscript.Shell")
set oEnv = oShell.Environment("PROCESS")
oEnv("SEE_MASK_NOZONECHECKS") = 1
Set fso = CreateObject("Scripting.FileSystemObject")
sScriptDir = "C:\Program Files\Altiris\Altiris Agent\Agents\SoftwareManagement\Software Delivery\{2803ADA4-5C8E-45BD-87BC-459445C57B2E}\cache\"
'Wscript.Echo sScriptDir
If fso.FileExists(sScriptDir & "MyApp.msi") Then
path = Chr(34) & sScriptDir & "MyApp.msi" & Chr(34)
sSwitch1 = " /qn"
sSwitch2 = " /norestart"
'wscript.echo path
i = 0
i = oShell.Run(path & sSwitch1 & sSwitch2 , 0 ,True)
If (i = 0) Or (i = 3010) Then
do
varRestart = oShell.Popup ("My pop up message", 3600, sTitle, vbExclamation+vbYesNo+vbSystemModal)
if (varRestart = vbYes) then
strShutdown = "shutdown -r -t 120 -f -m \\" & strComputer
oShell.Run strShutdown
end if
wscript.sleep 300000
loop
End If
End If

Thank you.
 
I am having some issues with the code to emulate 32-bit mode for the vbscript. I take it would not matter if it was a message box or pop up. Either way the emulation should be working.

Dim ScriptHost
Set oFso = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
ScriptHost="C:\Windows\SysWow64\cscript.exe "
oShell.Run ScriptHost & """" & Wscript.PGP_x64.vbs & """"
WScript.Quit

Our Altiris system already makes the per-determination between x64 and x32 systems. We are only targeting x64 so there is no need for the If-Else statement. I removed the If-Else statement at the suggestion of a colleague. What I am wondering is do I need to specify the path vbs being called from within this script? The error I get is on line 5, character 1, cscript required.
 
Minor note. May have been implied. Not sure, but both proxy vbscript and the vbscript I want to run are in the same folder.
 
I believe this will work:
oShell.Run ScriptHost & """" & [highlight #FCE94F]"PGP_x64.vbs"[/highlight] & """"

Or
oShell.Run ScriptHost & """" & [highlight #FCE94F]"C:\scriptpath\PGP_x64.vbs"[/highlight] & """"
 
>If you have an alternate suggestion for the OP's author then suggest it.


Er ... I already did. Have you been having a bad day or something?
 
>Wscript.PGP_x64.vbs

This is wrong. Sorry if I wasn't clear enough. It should simply be something like:

"PGP_x64.vbs"

and therefore, given your assertion that "both proxy vbscript and the vbscript I want to run are in the same folder", guitarzan's solution should work:

oShell.Run ScriptHost & """" & "PGP_x64.vbs" & """"

or

oShell.Run ScriptHost & """" & ".\PGP_x64.vbs" & """"


 
Hi All,

You guys been most helpful. If I could bother you guys a little longer. Is there any way to add in something that would log a success or failure code? to my original post in this thread. Desktop delivery tools like ZCM, SCM, Altiris can definitely work with the codes returned. I thought I saw something on Symantec Connect about this, but maybe I am completely off track here. So please do tell me if this is something that if it is do able really serves no purpose.
Thank you.
 
Would that also reflect a success code? Seems like it would only affect failure code. Not sure
 
It's just a number. What that number represents is really up to you.

If the fact that I called the variable "ErrorCode" is confusing, just mentally rename it "ReturnCode"

 
I would think this would run the MSI completely hidden and there is no interaction with it. I am just noticing a couple windows briefly flashing on the screen. Can this be tweaked?

If fso.FileExists(sScriptDir & "MyApp.msi") Then
path = Chr(34) & sScriptDir & "MyApp.msi" & Chr(34)
sSwitch1 = " /qn"

Thanks.
 
I thought about this after the fact. Maybe my proxy script (sets command emulation to 32-bit on 64-bit system) is the one that needs tweaking:

Dim ScriptHost
Set oFso = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
ScriptHost="C:\Windows\SysWow64\cscript.exe "
oShell.Run ScriptHost & """" & "Proxy.vbs" & """"
WScript.Quit

I think that is the one that sets things up to go. Is there more of a proper way to silently call a vbscript from another one?
 
Not sure what I am doing wrong on my end. For starters I was using wscript which I am assuming I can't use the ,0 with?

Can you tell me as far as this code can that be tweaked to be made completely hidden?

If fso.FileExists(sScriptDir & "MyApp.msi") Then
path = Chr(34) & sScriptDir & "MyApp.msi" & Chr(34)
sSwitch1 = " /qn"

Or is that is going to be as good as it gets?

 
For starters I was using wscript
Not in the example... there is no need for the ",0" with either wscript or cscript if the cmd does not generate a cmd window (e.g. oShell.Run "notepad.exe")

I don't know if those switches apply to .msi. You'll want to run the MSI through c:\windows\system32\msiexec.exe

Code:
oShell.Run "C:\Windows\system32\msiexec.exe " & path & sSwitch1

-Geates




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top