Unable to relaunch as Service in Terminal Server

Hi Experts
Please help. I have a GPO in the user logon vbscript in the following:

Set objShell = WScript.CreateObject("WScript.Shell")
'-------- DEFINE THE PROGRAM FILE LOCATION ---------
strExecuteFile = "\\tcf.local\Support\TSTemplate\bginfo.exe /NOLICPROMPT /timer:0 /all"

'-------- DEFINE THE CONFIGURATION FILE LOCATION ---------
'strConfigurationFile = ("\\tcf.local\Support\TSTemplate\TSWallpaper.bgi")

'-------- RUN COMMAND ---------
objShell.Exec strExecuteFile & strConfigurationFile

Users logon to Windows 2003 Terminal Server, encountered error message "Unable to relauch as a service".
LVL 1
chekfuAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
oBdAConnect With a Mentor Commented:
There's actually another error in the script; the bgi file is directly concatenated behind the /all, creating the string "/all\\tcf.local\Support\TSTemplate\TSWallpaper.bgi" which bginfo in all likelihood doesn't really like.
Let's do it consequently:
Set objShell = WScript.CreateObject("WScript.Shell") 
'-------- DEFINE THE PROGRAM FILE LOCATION ---------
strExecuteFile = "\\tcf.local\Support\TSTemplate\bginfo.exe"
 
'-------- DEFINE THE CONFIGURATION FILE LOCATION ---------
strConfigurationFile = "\\tcf.local\Support\TSTemplate\TSWallpaper.bgi"
 
'-------- DEFINE THE PROGRAM OPTIONS---------
strExecuteOptions = "/NOLICPROMPT /timer:0"
 
'-------- RUN COMMAND ---------
objShell.Exec strExecuteFile & " " & strConfigurationFile & " " & strExecuteOptions

Open in new window

0
 
RobSampsonCommented:
Hi, why is this line:
'strConfigurationFile = ("\\tcf.local\Support\TSTemplate\TSWallpaper.bgi")

commented out?  Without that line being executed, you are only executing the strExecuteFile, and not the configuration file.  Would this be why it's trying to "relaunch" the application?

Regards,

Rob.
0
 
oBdACommented:
Remove the "/all", that's where the message is coming from; to start with, users don't have permissions to write into other user's folders.
You don't need it anyway, because bginfo is started with each user's logon.
Oh, and make sure that the bitmap location defined in the bgi file is not at the standard setting (%Systemroot%\system32); change this to the user's Temp or Application folder.
0
2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

 
chekfuAuthor Commented:
Hello oBdA

You are right. I should removed "/all", however, it showed another error message:
===============================================
Error creating the output bitmap file
C:\WINDOWS\BGInfo.bmp:
Access is denied.
Please ensure the path the exists and you have permission to write it.
You can select a different output path for the bitmap using the Bitmap|Location menu item.
===============================================
I have confirmed again and again. The output bitmap is User's application data directory (%USERPROFILE%\Local Settings\Application Data\Winternals\BGInfo\BGInfo.bmp). I have another bgi configuration file, the output bitmap is manually set to (%USERPROFILE%\Local Settings\Application Data\BGInfo\BGInfo.bmp).
I have still encountered the same error message when I double-click the vbscript file manually. BGINFO always prompt for saving onto C:\WINDOWS\BGinfo.bmp.

Please help!
0
 
RobSampsonCommented:
Hi chekfu, I think that BGInfo does behave in a situation where it requires Admin rights (or at least specific rights to write to the Windows folder and certain parts of the registry).  I think that to provide this ability, you will need to copy your TSTemplate folder into the NetLogon folder of a domain contoller.  Then you can run a StartUp script, instead of a Login script, which will run under the system account, and you should be able to use the /all switch.  So, once you have moved the folder, you can use this:

Set objShell = WScript.CreateObject("WScript.Shell")
'-------- DEFINE THE PROGRAM FILE LOCATION ---------
strExecuteFile = "\\domain.com\sysvol\domain.com\scripts\TSTemplate\bginfo.exe /NOLICPROMPT /timer:0 /all"

'-------- DEFINE THE CONFIGURATION FILE LOCATION ---------
'strConfigurationFile = ("\\domain.com\sysvol\domain.com\scripts\TSTemplate\TSWallpaper.bgi")

'-------- RUN COMMAND ---------
objShell.Exec strExecuteFile & strConfigurationFile


Regards,

Rob.
0
 
oBdACommented:
Then it's not reading your bgi file.
Note that, as RobSampson already mentioned, the line where the bgi file to be used is commented out, so bginfo will run with default settings.
>' strConfigurationFile = ("\\tcf.local\Support\TSTemplate\TSWallpaper.bgi")
0
 
chekfuAuthor Commented:
Hello RobSampson:
I just tried. Sorry to inform that it is still the same.
0
 
RobSampsonCommented:
Ah, great pick-up!  Yes, maybe that will help.....
chekfu, notice that oBdA has placed an extra space ( & " " & ) in the objShell.Exec line....

Perhaps try that as a StartUp script.....

Regards,

Rob.
0
 
chekfuAuthor Commented:
Hello RobSampson

Your method works with below amendment done!! Really thanks a lot!!!

objShell.Exec strExecuteFile  & " " & strExecuteOptions & " " & strConfigurationFile

0
 
chekfuAuthor Commented:
Ooopsss.. really sorry!!

The award point goes to oBdA. Many thanks to oBdA.
0
 
RobSampsonCommented:
Excellent! No problem. Thanks for your help oBdA.

Regards,

Rob.
0
All Courses

From novice to tech pro — start learning today.