Hi... I'm not an expert in scripting, so I don't know how to solve my problem...

I've made a VBScript to upgrade/install an application, which requires a certain install order of 3 packages. It detects if there is a current version and uninstall if there is... It's working fine, but the problem is, that any Microsoft Office product is closed automatically when removing the old version and when installing the new version... There is nothing I can do about that, because the applications requires this, so therefore I want to inform the user, that is logged on the computer, that Office applications will be closed in order to upgrade this particular application...

I know how to make a messagebox in VBScripting, BUT since we want to deploy this upgrade through MS SCE2010 the script will be run as System Account, and therefore no messagebox to the user of the machine...

How can I make my VBScript show a message box to a user, when the script is running as the local system account?!

Cheers
Bo Urskov
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
0
May be if you inlcude the below code in your script should send a message.


set sh = createobject("wscript.shell")

sh.run "cmd /c net send %computername% <message>"

This code sends the message to the computer irrespective of who is logged in.
Answered 07/11/2011 by: sunny07
Senior Yellow Belt

Please log in to comment
0
Most corporate sites will have the "NET SEND" Messenger service disabled.
Answered 07/11/2011 by: VBScab
Red Belt

Please log in to comment
0
Hi...

I have thought of that approch as well, but as mentioned, NET SEND is not an option, since it is Windows 7, and therefore no NET SEND support... There is however a service call MSG.EXE but the problem as I see it, is that I need to know the username of the current user... But that could be retrieved by VBScript, right?!
Answered 07/11/2011 by: bourskov
Senior Yellow Belt

Please log in to comment
0
The name of the logged-in user can indeed be retrieved in VBScript. The other problem, though, which I meant to post about last night, is that the System account has no network access...
Answered 07/12/2011 by: VBScab
Red Belt

Please log in to comment
0
NET USE can't send you any user answer/feedback.

Are you shure SCE2010 doesn't support iteraction with user contex? it should. Please check first of all.

if - not, I recomment you using psexec to show something to user and get answer.
Answered 07/12/2011 by: itolutions
Orange Senior Belt

Please log in to comment
0
Hi...

I'm not sure about user interaction with SCE2010, but I'll follow up on that point...

Just to clarify... I don't need the user to interact with anything... I just want to present some kind of message to the user, that during this mandatory upgrade of this application, their Office applications will close automatically... This is to prevent our IT department to be overloaded with users who think there is something wrong...

Since this installscript will run locally on the clients, I don't need the system account to have network access, and I've tested with PsExec on my local computer to run the msg.exe tool, and it works...

So if there is no other solution, I think I just have to make my VBScript get the username for the current user, and send a msg.exe to localhost\%username%

Cheers
Bo Urskov
Answered 07/12/2011 by: bourskov
Senior Yellow Belt

Please log in to comment
0
Sorted it out... :)


strComputer = "."
strDomainPrefix = "DOMAINNAME\" 'Set this to your actual domainname, i.e. WINDOM -
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")

For Each objComputer in colComputer
Wscript.Echo "User Name = " & objComputer.UserName _
& VBNewLine & "Computer Name = " & objComputer.Name

If objComputer.Username <> "" Then ' There is a user logged on locally.
Username = Replace(objComputer.Username, strDomainPrefix, "") ' This will fail, if no user is logged on locally.
End If
WScript.Echo objComputer.UserName
WScript.Echo Username
WScript.Echo objComputer.Domain

Txt = "Text to current user goes here..."
Set WshShell = WScript.CreateObject("WScript.Shell")
Return = WshShell.Run("msg " & Username & " " & Txt, 1, true)


Next


This is a part of the script I ended up with... It is working perfectly when deployed by SCE 2010 and the script is being run as NT AUTHORITY\SYSTEM

If there is a user logged on, the user will get a message, if not, the script just does it's job...

This is tested with Windows 7 Enterprise...

Cheers
Bo Urskov
Answered 07/18/2011 by: bourskov
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity